Sonu Pandey

Sonu Pandey

  • NA
  • 15
  • 8.4k

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

Aug 6 2016 4:33 AM
 
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)