Asp.Net Request Yapan Bilgisayarın IP’sini Elde Etme

private string getClientIp()
{
string clientIP= “”;
if (HttpContext.Current.Request.ServerVariables[“HTTP_VIA”] != null)
{
clientIP= HttpContext.Current.Request.ServerVariables[“HTTP_X_FORWARDED_FOR”].ToString();
}
else
{

clientIP= HttpContext.Current.Request.ServerVariables[“REMOTE_ADDR”].ToString();
}
return clientIP;
}

Bir cevap yazın