8
Answers

How to get Visitor IP Address and Location in ASP.Net

Sonu Pandey

Sonu Pandey

8y
517
1
 
I am using this code but this is not show Visitor IP Address 
 
string ipaddress;
ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (ipaddress == "" || ipaddress == null)
{
ipaddress = Request.ServerVariables["REMOTE_ADDR"];
}
Response.Write(ipaddress);
 
Please help me  
Answers (8)