I have a web application that should behave differently for internal users than external ones. The web application is available over the Internet, and therefore obviously to the internal users as well.
All the users are anonymous, not authenticated, but the page should render differently for internal users than external. What I'm doing in my code is use Request.UserHostName
and then Dns.GetHostEntry
. The result is then compared to a setting in my web.config
(that holds something like *.mydomain.local
) . If the comparison gives a positive result then I render the HTML that the internal user should see otherwise I render the HTML the external user should see.
However, my problem is that I don't always get the expected value from Request.UserHostName
. on the development site I get the IP-number
(?) of the machine running the browser but on the customer site I don't get the IP-number
of the user machine, I get some other IP-number
. The browsers don't have any proxies set or anything like that.
Should I be using something else than Request.UserHostName
?