g
Printer Friendly Version

editor  
BellaOnline's ASP Editor
 

Referring URL with HTTP_REFERRER

When you are coding ASP pages, you often want to know where the user came from. Using HTTP_REFERRER lets you code your pages based on what path the user followed.

Simply put, add this code to your ASP page -

RefURL = Request.ServerVariables("HTTP_REFERRER")

Now you have the full value of the previous URL in the RefURL variable. Users can of course block this with their browser settings if they want to, but not all users are quite that paranoid about their security settings.

There are many reasons that knowing the referring page can be useful.

* You can make sure that a thank you page thanks the person based on what product they bought.

* You can ensure that a paypal return page only activates fully for someone that really DID just come from the PayPal website.

* If someone tries to 'leap' to a end-stage page directly, you an always response.redirect the user back to the starting point.

Make sure you do account for users that have blocked this feature, so they at least see a page explaining that they need to change their security settings.

ASP Site @ BellaOnline
View This Article in Regular Layout

Content copyright © 2013 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.



| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor