Go deep into HTTP Referer

Source: Internet
Author: User
Tags servervariables

 

In short, HTTP Referer is part of the header. When a browser sends a request to a Web server, it usually carries a referer to tell the server from which page the link is sent, the server obtains some information for processing.

For example, if a user is linked to a friend on my homepage, his server can calculate from HTTP Referer how many users click the link on my homepage to access his website every day. The Referer should be an English word referrer, but there are too many people who misspelled the Referer, so the people who write the standard will be wrong. Request. servervariables ("http_referer") usage (Anti-external connection ).

 

In the following cases, the request. servervariables ("http_referer") is obtained from the address bar of the browser:

1. directly use <a href>

2. Form submitted with submit or <input type = image> (post or get)

3. Form submitted using JScript (post or get)

Next let's take a look at the situations where the request. servervariables ("http_referer") cannot be set properly:

1. Link from favorites

2. Click 'homepage' or a custom address.

3. Use location. href or location. Replace () of JScript ()

4. Enter the address in the browser.

5. <% response. Redirect %>

6. <% response. addheader %> or <meta http-equiv = Refresh> redirect

7. Load the address in XML

 

 

How request. servervariables (http_referer) Works

The method for obtaining Referer in JSP is: request. getheader ("Referer ");

In PHP, you can obtain a referer by: $ _ server ['HTTP _ referer'];

The method for obtaining a referer in ASP is: request. servervariables ("http_referer ")

 

Turn: http://www.cnblogs.com/ly312/archive/2011/02/23/1962052.html

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.