How to get ip address in asp.net using csharp | Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

How to get ip address in asp.net using csharp

Saturday

Get IP Address Of A System using c# :

  The following just two line code to useful for Get IP Address Of A Machine using C#.

Code:

     // Get the hostname 
        string yourHost = System.Net.Dns.GetHostName();

        // Show the hostname 
        lblMyhost.Text = yourHost;

        // Get the IP from the host name
        string yourIP = System.Net.Dns.GetHostEntry(yourHost).AddressList[0].ToString();

        // Show the IP 
         lblIPAddress.Text = yourIP;

0 comments:

Post a Comment

Share your thoughts here...

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets