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

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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.