Checking if client and server are the same machine.
bool IsClientAndServerSame(HttpRequest request)
{
String remoteAddress = request.UserHostAddress;
if (remoteAddress == null remoteAddress.Length == 0)
return false;
if (remoteAddress == "127.0.0.1" remoteAddress == "::1")
return true;
if (remoteAddress == request.LocalAddress)
return true;
return false;
}
bool IsClientAndServerSame(HttpRequest request)
{
String remoteAddress = request.UserHostAddress;
if (remoteAddress == null remoteAddress.Length == 0)
return false;
if (remoteAddress == "127.0.0.1" remoteAddress == "::1")
return true;
if (remoteAddress == request.LocalAddress)
return true;
return false;
}
Comments