CODEDIGEST
Home Articles CodeDigest Tutorials FAQs
Home > CodeDigest >  
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!");
        }

Recent Codes
  • View All Codes..