Site Meter Asp.Net-Csharp,Asp,Ado.Net,Ado,Micosoft,Visualstudio,Visual webgui: Find client and server ip address in asp.net,C#.

Thursday, November 26, 2009

Find client and server ip address in asp.net,C#.

Find client and server ip address in asp.net,C#.

To get Server IP Address and Name(ie)where your domain hosted in an server:


1. string strHostName = System.Net.Dns.GetHostName();
2. string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();


To get Client IP address ie system current IP address:

1.Response.Write(Request.ServerVariables["http_user_agent"].ToString());

Your IP address is:
2.Response.Write(Request.ServerVariables["remote_addr"].ToString());

The DNS lookup of the IP address is:
3.Response.Write(Request.ServerVariables["remote_host"].ToString());

The method used to call the page:
4.Response.Write(Request.ServerVariables["request_method"].ToString());

The server's domain name:
5.Response.Write(Request.ServerVariables["server_name"].ToString());

The server's port:
6.Response.Write(Request.ServerVariables["server_port"].ToString());

The server's software:
7.Response.Write(Request.ServerVariables["server_software"].ToString());

1 comment:

  1. Or simply you can use below mentioned URL

    http://tejji.com/ip/myipaddress.aspx

    Above address shows you IP as well as MAC addresses

    ReplyDelete