Solved

How do I know the previous URL ?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 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

12 Experts available now in Live!

Get 1:1 Help Now