Saturday, February 7, 2009

Getting User IP address for a Web Site.

To get user System IP address for a website which is hosted.


we can use the above code in another way as:

string VisitorIPAddress = Request.UserHostAddress.ToString();

Or, you can use REMOTE_ADDR from ServerVariables collection, with code snippet like this:

string VisitorIPAddress = Request.ServerVariables["REMOTE_ADDR"];

No comments: