asp.net the problem of fake IP for obtaining client IP common code

Source: Internet
Author: User
Tags servervariables
If a site is through the following code to obtain IP, then we simply set in the header Http_via and x_forwarded_for, you can achieve the purpose of fake IP

in the network card a random search: asp.net client IP
Many pages can be searched, and the code provided is basically similar to the following:

Copy Code code as follows:
if (request.servervariables["Http_via"]!= null)
return request.servervariables["Http_x_forwarded_for"]. Split (new char[] {', '}) [0];
Else
return request.servervariables["REMOTE_ADDR"];


The Http_via and http_x_forwarded_for in the above code are obtained from the header submitted by the client, and in normal HTTP interactions, REMOTE_ADDR cannot be forged (note),

So if a Web site is through the above code to obtain IP, then we simply set up in the header Http_via and x_forwarded_for, you can achieve the purpose of fake IP, you can use Firefox plug-in "Modify Headers" to test, Use it to add headers

Note: In fact, REMOTE_ADDR can also be forged, but will cause the normal reception of data, such as writing a letter, the sender to write a false address, it is certainly impossible to receive the reply of the other person

Related Article

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.