Forum Moderators: phranque
Here are the pages and partial content:
[B]Product Page...[/B]
(purpose: contains links to pdfs. some require registration, others don't)
<a href="<%="login.asp?filename=file1.pdf"%>">File1</a><br>
<a href="file2.pdf">File2</a>
[B]Login Page...[/B]
(purpose: ask for email, if previsouly registered email is found in db, open pdf...if not previously registered, provide link to registration page and remember which pdf was requested)
<p>If you haven't registered, <a href="<%="registration.asp?filename=" & request.querystring("filename"[smilestopper])%>">GO HERE</a><br><br>
If you've previsouly registered, enter your email below:</p>
<form>
...I've got working code to request email...
</form>
<% function CheckDatabase()
...I've got working VBscript and SQL code to check Oracle db for email...
HERE'S WHERE I NEED HELP:
open pdf in CURRENT window so if back button is used, the user returns to Product Page not to the Login Page.
I've tried using response.redirect(request.querystring("filename"[smilestopper])) which returns the undesired behavior explained above.
Are there other ways to do this ( non-javascript) that play well with today's pop-up blockers, i.e. XP SP2, etc?
end function %>
[B]Registration Page...[/B]
(purpose: requests user information, writes to db, opens requested pdf)
<form>
...get all user details...
</form>
<% function WriteToDB()
...I've got working VBscript and SQL code here...
HERE'S WHERE I NEED HELP:
open pdf so that if the back button is used the user returns to Product Page not to the Login or Registration Page.
The only thing I've seen is to use Javascript history.go(-2), but I can't get it to work. Are the alternatives?
end function %>
Thanks so much for your help...I'm desperate! Any good copy and paste code out there with this functionality?
I know what you are trying to do... But have you considered making two sub-directories? Ie:
/public
/private
Leave the /public folder as-is. Put all of your pdf's that you want available to everyone in there. Then through your IIS contorl panel (Or whatever your host has set up), "protect" the /private directory. Place all of the "proctected" pdf's here. You will be able to set up a list of usernames and passwords. (You can aslo do this with an Access Database and ASP.) This way, once a user is logged in, they won't have to re-login for every PDF they want to view, their session will only end when they close their browser.
Just a thought ... :0)
-- Zak
at the begining of your registration/login pages do a response redirect if session variable is set:
<% if (session("validated") = "true") then response.redirect("products.asp") %>
& at the top of any sensitive pages:
<% if (session("validated") = "false") then response.redirect("login.asp") %>
of course you'll need to set the session variable on login..