Knowing which page the user come from for logging them back in ASP

Posted on 2006-04-13
Last Modified: 2012-05-05
Hi All

I want to change the login process on my application so that after the user is redirected back to the login page when thier username expires that they can be redirected back to the page they were on. My login is done through login.asp

The page that are normally on is called recorddetails.asp which has an include file called sessioncheck.asp which has the following code

yourPage = request.ServerVariables("http_referer")
strUsername = session("Username")
if strUsername = ""  or strUsername = NULL then
               Response.redirect "login.asp?ReturnUrl=" & yourpage
End if

Now if it was a simple page like recorddetails.asp then it is not a problem but I am also passing the id of the record through the querystring.

so my recorddetails.asp page is the url looks like recorddetails.asp?Id=2665

is there anything I can do pick the whole url rather than just the name of the page.

Thanks in advance for any help
I can use the
Question by:isnoc
    1 Comment
    LVL 2

    Accepted Solution

    Simply use this :

    yourPage = request.ServerVariables("http_referer") & request.QueryString

    Request.QueryString will return anything that pushed into your url after ? symbol

    hopfully assist you

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    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!

    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…
    I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    760 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

    8 Experts available now in Live!

    Get 1:1 Help Now