HttpContext.Current.Request.UserHostAddress.ToString()
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:
Post a Comment