URL capture and redirect

D

DGS

Hi guys,

Not a developer, but an admin so please pardon my ignorance.

I have an issue that I was hoping to get help with. What I need is for the
front page of my site to capture the URL that the user is requesting.
Regardless of where they go, they are prompted to login...but I want the
initial login page to capture where they have REQUESTED to go and store it
somewhere (I assume a cookie).

Then...later on in the process they will hit a redirect page which will read
that cookie value and send them to the originally requested page.

The reason for all of this is that the current redirection we are using
works fine, only it uses the "referrer" header and if the user is sent to a
"password change" or "incorrect password" screen then the referrer header
changes and becomes useless once the user goes to the latter redirect.html
page.

Any help is GREATLY appreciated.
 
E

Evertjan.

Randy Webb wrote on 17 mei 2007 in comp.lang.javascript:
DGS said the following on 5/16/2007 9:10 PM:

Add an onclick to all the links:

onclick="saveCookie(this.href)"

And then save the href in a cookie.

Good idea, Randy, but it would fail, if the user has multiple sessions in
different windows of the same browser type, as cookies do not natively
know about sessions.

I think we should advice the OP to use serverside sessions and scripting,
also while his stipulation of a login already hopefully implies having
serverside technology available.

asp jscript:

<script language='jscript' runat='server'>
if (session('loggedin') != 'yes') {
session('urlToReturnToAfterLogin') = request.Servervariables('URL');
response.Redirect('login.asp');
}
</script>

Using an include for this makes life even easier.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top