Find if the request was sent from the firewall to IIS
I hope this is not a very strange question. I am running a web service on an IIS server that can be accessed either from the internal network or from the outside (like the Internet) by port forwarding.
External: For example, if I connect to my server from the internet using http: // my_public_domain_name , then the firewall will forward port 80 to my server.
Internal: Assuming my server has ip 10.50.1.1 on the local network and my computer is at 10.60.1.1 (same Iranian, different subnets), I can access it http://10.50.1.1 .
When I receive a request in IIS (ASP.NET), I need to know if the request was forwarded by a firewall or if it was sent internally.
Thank.
source to share
In one servlet, I only wanted admin access from the local network, so I took the internal IP range I was using and created a simple rule to login as administrator that checked to make sure my IP was in that range ...
In Java, I used HttpServletRequest.getRemoteAddr () and getRemoteHost ().
Looking at this page http://www.geekpedia.com/tutorial45_How-to-get-IP-address-of-client.html it looks like the ASP equivalent:
Request.ServerVariables ("REMOTE_ADDR")
And something like this page will help you determine if it is a private (internal) IP range or not: https://en.wikipedia.org/wiki/Private_network (not sure if this is useful for IPv6 IPs)
source to share