Question

I'm writing a program that is accessed from a local network and also from the outside. I have to identify local and outside requests in order to give different functionality to each. Is that possible? An alternative is to document the IP addresses of all the local computers and to get the IP address of the client thru Request.ServerVariables["Remote_ADDRS"] and compare them, if the request IP address doesn't match that means the request is not local. That seems to be awkward and inefficient because I would have to save all local addresses and any new computer would have to be regestered. Is there a simple way to identify if a request is coming from the local network or from the outside? Thank you!

Was it helpful?

Solution

Your network administrator will be able to tell you the IP range of the internal network. Then you can simply check if the client IP falls into the internal range.

This way, you only need to change your configuration, when the internal ranges is changed. This should not happen too often.

Edit: Here is a question and answer about IP ranges (albeit in Java, but should be very simple to convert).

OTHER TIPS

Are you on a domain with the internal users? If so you could just offer the internal functionality only to those who login with integrated authentication.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top