Obtaining the connecting clients IP address (Real IP) in C# (ASPX):
ASP.NET/ASPX is a server-side Web application framework designed for Web development to produce dynamic Web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services.
This is not required if your webserver is configured to retrieve the clients IP
C# (ASPX) Method:
C# (ASPX) supports the X-Real-IP header through the definitions within the .aspx web files. The definitions are usually entered in the web pages configuration files. To enable X-Real-IP IP forwarding for the retrieval of the connecting users IP address.
Edit a ASPX file that is opened every-time your website is visited, configuration files are usually opened each time a user visits. These could be named: config.aspx, global.aspx, defines.aspx
- Open one of your configuration files in your favorite text editor:
- At the end of the configuration file, add:
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"] = HttpContext.Current.Request.ServerVariables["HTTP_X_REAL_IP"]
This configures your script to look for the X-Real-IP header, and uses that as the clients IP address instead of your proxy IP.
If successful the IP of users connecting through the proxy service should be visible in the you are using on your website.