Click here to Skip to main content
15,892,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am looking for the code that help me to transfer the web site visitor with specifed IP to other web address
Posted

You can get the actual ip of the client using this code below (it will get the real client ip, even if the client is using a proxy)

C#
string ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR");
if (!string.IsNullOrEmpty(ip))
{
   string[] ipRange = ip.Split(',');
   ip = ipRange[0];
}
else
{
   ip=Request.ServerVariables("REMOTE_ADDR");
}


The can be done rather simple using a Response.Redirect.

Good luck!
 
Share this answer
 
thank you for your reply, do you know any IP table that confine the location and related country of each IP ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900