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!"); }
|