Get the real IP address of a remote user

Source: Internet
Author: User
Tags return servervariables tostring
 
 
    1. **//// <summary>  
    2. ///  maximize the real IP address of the remote user  
    3. /// </summary>  
    4. /// <returns></returns>  
    5. private string getclientip ()  
    6. ... { 
    7.      if (request.servervariables["Http_via"]!=null)  
    8.     .. { 
    9.         return request.servervariables["HTTP_X_ Forwarded_for "]. ToString ();  
    10.       
    11. &NBSP;&NBSP;&NBSP;&NBSP;ELSE&NBSP;
    12.      { 
    13.          return request.servervariables[" REMOTE_ADDR "]. ToString ();  
    14.       
    15. }&NBSP;

HTTP Proxy-related knowledge
Http_x_forwarded_for
If this information is available, it also proves that the address of the proxy proxy server you are using is the following value. The
need to note that the value of the,http_x_forwarded_for  is not necessarily a single IP address, the following information is also possible, one record per line. The data below is based on csdn actual data.
10.194.73.11
Unknown, unknown, 211.100.22.30
203.98.182.163, 203.98.182.163, 203.129.72.215
172.16.20.110, 202.116.64.196, 203.81.21.61
10.194.75.83, 10.194.73.11, 10.194.73.11, unknown
192.168.120.57, Unknown, unknown, 211.10.10.195
10.2.4.211, 219.141.250.3
3.242.165.168, 218.108.22.164
Unknown, 211.100.22.30
192.168.83.56, 210.21.224.233
218.94.136.176, 203.81.21.61
Unknown, 210.75.1.181
10.161.196.218, 202.104.134.23
222.216.6.148, 222.216.6.146
155.161.59.47, Unknown
key is in Http_x_forwarded_ for 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.