I hope it is not too weird question.
I’m running a web service on an IIS server which can be accessed either from internal network or from external (i.e Internet) by port forwarding.
External:
For example, if I connect to my server from the internet with http://my_public_domain_name than the firewall will forward port 80 to my server.
Internal:
Assuming my server has the ip 10.50.1.1 in the local network and my PC is in 10.60.1.1 (same itranet, different subnets) than I can access it by http://10.50.1.1.
When I get the request in the IIS (ASP.NET) I need to know whether the request was forwarded by the firewall or was it arrived internally.
Thanks.
In a Servlet once, I wanted to have admin access from LAN only, so I took the internal IP range I was using, and created a simple rule for loggin in as admin that checked to see that my IP was in that range.
In Java, I used HttpServletRequest.getRemoteAddr() and getRemoteHost().
Looking in this page http://www.geekpedia.com/tutorial45_How-to-get-IP-address-of-client.html, it looks like the ASP equivalent is:
Request.ServerVariables(“REMOTE_ADDR”)
And something like this page would help you determine if it is a private (internal) IP range or not: https://en.wikipedia.org/wiki/Private_network (not sure if it is helpful for the IPv6 IPs)