- IP Of Client machine
- the following function is used to get IP of Client Machine
Public string GetIPOfClient()
{
string returnvalue = string.Empty;
try
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
string ip = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
returnvalue = context.Request.ServerVariables["REMOTE_ADDR"];
if (!string.IsNullOrEmpty(ip))
{
string[] addresses = ip.Split(',');
if (addresses.Length != 0)
{
returnvalue = addresses[0];
}
}
}
catch (Exception)
{
}
finally
{
}
return returnvalue;
}
Comments
Post a Comment