I\'m running a web application that displays some debugging behavior if it\'s being run locally - quotes around resource strings, etc - and I\'d like to demo the application on
Request.IsLocal property implements the following code :
public bool IsLocal {
get {
String remoteAddress = UserHostAddress;
// if unknown, assume not local
if (String.IsNullOrEmpty(remoteAddress))
return false;
// check if localhost
if (remoteAddress == "127.0.0.1" || remoteAddress == "::1")
return true;
// compare with local address
if (remoteAddress == LocalAddress)
return true;
return false;
}
Source : Decompiled source code (Microsoft : referencesource.microsoft.com )
Hope this helps !