Solved

ASP Linking

Posted on 2004-08-03
2
239 Views
Last Modified: 2010-04-17
I know in PHP, the code to grab a link is echo $link

How can I grab a URL from a previous page using ASP?

Thanks!
0
Comment
Question by:Nitestarz
2 Comments
 
LVL 18

Accepted Solution

by:
tusharashah earned 500 total points
Comment Utility

request.servervariables("http_referer")

[providing that the page the script placed on is not the startup page for the browser session, was not hard coded into the address bar or not opened as a favorite.]

- tushar
0
 
LVL 2

Expert Comment

by:MGrassman
Comment Utility
Here ya go.
<%
    Response.Write "Referer: " & Request.ServerVariables("HTTP_REFERER")
%>

This won't work in all cases though.  Below is a list of what will and will not work.


The situations where this ServerVariable works
---clicking on a straight HTML <a href> link;
---submitting a form, using POST or GET, from a submit button, <input type=image> or client-side script (form.submit())

The situations where it doesn't work:
---clicking on a Favorite, History, or the recently-typed URLs list
---clicking on 'Home' in IE's toolbar, or an item in IE's 'Links' toolbar
---using location.href or location.replace() in client-side JScript/JavaScript/VBScript
---using HierMenus (details)
---typing the URL directly in the browser and hitting Enter or clicking 'Go'
---launching a clickable URL from an e-mail or MS Office document
---using Response.Redirect / Server.Transfer
---using Response.AddHeader (302) or <meta http-equiv=refresh> to redirect
---misspelling the variable name (many people assume HTTP_REFERRER).
---Obviously, this variable cannot be relied upon for many situations.
 
Hope this helps,

Michael Grassman
{personal website url removed - ee_ai_construct, cs moderator}
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now