Getting the page referrer from header information in ASP

Visitors come to different pages of a site or move from one site to other by clicking links. When they arrive at a page, we can collect the URL of the referrer page ( the page which has send them here ) by using the Request object and its ServerVariable pairs.

By using referrer once we can know how many visitors are coming from google or from other search engines and what are the keywords they are using.

In PHP we can get the referrer URL and details are here.

In ASP we will collect the http header information to get the referrer. Note that if some one has typed the page name in address bar and reached the page then referrer information will not be there. Referrer information along with some other data are used for logging or tracking the visitors.

We will use http header name HTTP_REFERER to get the URL ( site address ) of the referrer . Here is the code.

<%= Request.ServerVariables("HTTP_REFERER")%>

Some browsers have settings to manage the header information. This way one of the important header referrer header information can be blocked. For Firefox browser at the address bar type about:config and browse through the settings, select and change the values if you want. ( be warned to change the settings , and read all the guidelines and read in details from Mozilla and other resources )


The above header is to be made to 2 if referrer is to be send through header.

Number of User Comments : 1



what about users that visit our site by scripts from another site
<script locate='www.mysite'>
how can we find address of site that visitors are comming

Post your comments , suggestion , error , requirements etc here .

We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer