Solved

How do I know the previous URL ?

Posted on 2001-07-05
4
226 Views
Last Modified: 2008-03-17
Let say I have a ASP page called previous.asp.

How do I know and print out the previous URL before coming to previous.asp.
I am NOT talking about server variable - HTTP_REFERER.

For example, I am viewing 123.45.678.2/test.asp, then I changed my URL at the location
textbox, and typed 123.45.678.2/hello/previous.asp and hit enter to visit previous.asp.

Then, I should see 123.45.678.2/test.asp get printed on the screen. How do I do that ?
0
Comment
Question by:idontknow12002
4 Comments
 
LVL 2

Expert Comment

by:rdmjrb
ID: 6258306
I ran across a similar problem and came up short trying to deal with the 'Back' button. The technology simply was not there. When the user does not use your application to navigate you are, as I found, at a loss. However, I would love to see this solution!

1. use the javascript DOM's 'history' object
2. store the name in a hidden variable, pass it along appropriately
3. use a modal browser, with no 'location textbox' or menu items, now you can see where they are coming from and print it out all day
0
 

Expert Comment

by:santhoshgivesuanswers
ID: 6258727

hi..i think history will do it

history.go(-1)  //call this in a function


rgds
san
0
 

Expert Comment

by:Salti
ID: 6259280
URL information in the history object is not accessible as property values in IE. They are in Navigator 4 and later with special privilege.
You can navigate the history object by calling its methods (back(), forward(), go()).
As far as I know, you cannot do what you want to do.
0
 
LVL 4

Accepted Solution

by:
epeele earned 25 total points
ID: 6259480
As long as you are within the same domain, you can write the current page to a Session variable.  You'd do it like this.


<%

   Session("PrevPage") = Session("CurrentPage")
   Session("CurrentPage") = Request.ServerVariables("SCRIPT_NAME")

%>


Or you could hardcode the name of the page where the Request.Server variables is.  This way on each page, you could access the previous page visited by calling:

<%=Session("PrevPage")%>

And when each new page is visited, the value in Session("CurrentPage") is replaces the value in Session("PrevPage") before being overwritten by the actual current page.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

809 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