NCS Logo - Click for home page Northstar Developer Center
Platforms
All Platforms
.NET Framework (1.x - 4.x)
Active Server Pages
ASP.NET
C#
SQL Server
VB.NET
Visual Basic

Keywords
.NET Data Types
.NET E-mail
.NET Events
.NET Functions
.NET Object Programming
.NET System.Configuration
.NET System.Diagnostics
.NET System.IO
.NET System.Net
.NET System.Net.Sockets
Active Data Objects
ASP Architecture
ASP Black Belt
ASP Built-in Functions
ASP Built-in Objects
ASP Debugging
ASP Performance
ASP Security
ASP Syntax
ASP.NET Authentication
ASP.NET Controls
ASP.NET Data Access
ASP.NET Features
ASP.NET Master Pages
ASP.NET Page Events
ASP.NET Security
ASP.NET ViewState
Atom
Certifications
COM, DCOM, COM+
Data Access
E-Mail
Errors
Exporting Data
HTML Tips
IIS
Object-Oriented Programming
RSS
SQL
Uncategorized ASP Tips
VB API Programming
VB Forms
VB Syntax
XML

Book Support
Visual Basic 6 Bible
ASP Bible
ASP Weekend Crash Course
ASP.NET At Work
Creating Web Services

Getting the Previous Page with HTTP_REFERER

Written by Eric Smith, Northstar Computer Systems LLC

A number of people have reminded me that there is a bug in IE that causes the HTTP_REFERER variable not to fill properly in certain cases. This means that if you post results from one page to another, the HTTP_REFERER will not always point to the correct location. If you're looking to do a back button, you can use a little Javascript to manipulate the user's browser history. Here's a link that will cause the browser to go back two entries in the history:
<a href="javascript:history.go(-2)">Return to the first page</a>
This Javascript works fine in IE 5.0 – your results may vary in other browsers. If you do need the page name as part of the form input data, just add a hidden input field with the value of
Request.ServerVariables("SCRIPT_NAME")
. That way you guarantee that the filename is sent along with the rest of the form data.

Keywords: [ Uncategorized ASP Tips ]

Publication Date: 7/13/2000