Home » ASP.Net | C#

Getting the IP address of server in ASP.Net and C#

3. September 2010 by jdelpay 0 Comments

Drop a label in your aspx page.

in code behind:

   1: string strHostName = System.Net.Dns.GetHostName(); 
   2:      IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); 
   3:      IPAddress ipAddress = ipHostInfo.AddressList[0];
   4: label1.Text = Convert.toString(ipAddress);
If you have any question, shoot me an email

Comments