-1

Is there any known way for asp.net to check if it runs on Intranet?

Edit

I need to show in my asp.net web page that the user runs in an intranet environment.

http://mysite/default.aspx

How can Default.aspx.cs tell me if he's running on intranet environment or in internet environment ?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Royi Namir
  • 144,742
  • 138
  • 468
  • 792

1 Answers1

2

You can check when someone ask your server if the IP is in a private IP class : 10.0.0.0/8 172.16.0.0/12 or 192.168.0.0/16. You can also add params in your configuration for intranet deployement (if you have multiple deployement).

Julien DAUPHANT
  • 250
  • 2
  • 10
  • The Ip of the server ( in my intranet ) is : 192.168.100.33 , does it fits the /16 thing ? – Royi Namir Dec 04 '11 at 15:06
  • 192.168.0.0/16 correspond 192.168.0.0 to 192.168.255.255 . Your can be expose to internet if a router NAT a port to your server : you have this configuration if your server respond to intranet and internet, in this case you compare the IP of client with private class. (this answer is not valable if you use reverse proxy) – Julien DAUPHANT Dec 04 '11 at 15:08
  • so /16 is .8.8 ? Can you reference me a to google for learn it ? thanks a lot. – Royi Namir Dec 04 '11 at 15:10
  • @RoyiNamir In complements of SLaks link you have : http://en.wikipedia.org/wiki/Private_network – Julien DAUPHANT Dec 04 '11 at 15:15