How do get client system IP address

Posted by Kannan1986 under ASP.NET on 2/1/2010 | Views : 4503 | Status : [Member] | Replies : 4
How do get client system IP address




Responses

Posted by: Vuyiswamb on: 2/1/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down


String IP = Request.UserHostAddress;


Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 2/1/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Use this :
string IPAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if(string.IsNullorEmpty(sIPAddress)
IPAddress = Request.ServerVariables["REMOTE_ADDR"];

If the user uses a Proxy, you can get from
IPAddress =Request.ServerVariables["HTTP_X_FORWARDED_FOR"]

I hope this would help you.

Cheers.

www.abhisheksur.com

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bubbly on: 2/2/2010 [Member] Bronze

Up
0
Down
Hello,

IPAdd = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If IPAdd = "" Then
IPAdd = Request.ServerVariables("REMOTE_ADDR")
End if

++
Thanks & Regards,
Deepika

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 2/3/2010 [Member] Bronze

Up
0
Down
Hi

Ref this link
http://www.aspxcode.net/free-asp-net-sample-source-code.aspx?Topics=How%20to%20get%20IP%20Address%20of%20Visitor%27s%20Machine

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response