how can i tell if a page is being served on a local lan?

This does the trick. It detects external ip address from outside the lan and internal ipaddress from inside the lan. And if the page is accessed from an external LAN with a matching ipaddress, it still returns the external one.

protected void Page_Load(object sender, EventArgs e) {
String thisipaddress = Request.UserHostAddress;   <-----THIS

if (thisipaddress == "" || strings.left(thisipaddress,7)=="192.168"){
    hiddenarea.Visible = true;
} else {
    hiddenarea.Visible = false;


CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top