Showing posts with label ip. Show all posts
Showing posts with label ip. Show all posts

Friday, November 4, 2011

How to detect the client IP in asp.net

You just use the following code snippet. It is perfect also.

string clientIP = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

if (clientIP == "" || clientIP == null)

{

clientIP = Request.ServerVariables["REMOTE_ADDR"];

}


Enjoy the programming!
Thank