// Use the following code to get the user ipaddress
public string GetCurrentIpAddress(HttpContextBase httpContext)
{
if (httpContext != null && httpContext.Request != null
&& httpContext.Request.UserHostAddress != null)
return httpContext.Request.UserHostAddress;
else
return string.Empty;
}
//syntax for calling the above method.
string UserIp = GetCurrentIpAddress(Request.RequestContext.HttpContext);
Comments
Post a Comment