?
Solved

How do I know the previous URL ?

Posted on 2001-07-05
4
Medium Priority
?
230 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 100 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

777 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