CODEDIGEST
Home » CodeDigest
Search
 

Technologies
 

Get Website IP Address in ASP.Net
Submitted By Satheesh Babu B
On 6/2/2009 9:16:53 AM
Tags: ASP.Net,CodeDigest  

Get Website IP Address in ASP.Net

Sometimes, we may need to get the IP address of a website in asp.net.

The following little code snippet will help us to do that.

try
        {
            System.Net.IPAddress[] ip = System.Net.Dns.GetHostAddresses(txtSite.Text);
            Response.Write(ip[0]);
        }
        catch (System.Net.Sockets.SocketException)
        {
            Response.Write("No Such Website!");
        }

Do you have a working code that can be used by anyone? Submit it here. It may help someone in the community!!

Recent Codes
  • View All Codes..