Solved

How do I know the previous URL ?

Posted on 2001-07-05
4
227 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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/…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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