How to do this the reliable way, a very simple solution is to use the 'isLocal' property of the Request class as shown below:
C#
protected void Page_Load(object sender, EventArgs e)
{
if (HttpContext.Current.Request.IsLocal)
{
Response.Write("App is local");
}
}
VB.NET
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If HttpContext.Current.Request.IsLocal Then
Response.Write("App is local")
End If
End Sub
Verry good tip
ReplyDelete