How to check if localhost
What about something like:
public static bool OnTestingServer()
{
string host = HttpContext.Current.Request.Url.Host.ToLower();
return (host == "localhost");
}
As a comment has the correct solution I'm going to post it as an answer:
HttpContext.Current.Request.IsLocal