I need a ServerVariables("HTTP_REFERER") login script
Posted on 2003-03-10
I have three asp pages:
On Search.asp, when you click the "AddTopic" button, you are taken to the Add_Topic.asp page.
At the top of the of the Add_Topic.asp page is a login-check that looks for the existence a session variable:
if Session("pass") <> "ok" then
Now Session("pass") is only written from the Login.asp page. So coming from Search.asp, there is no existance of the variable and so the browser is redirected to Login.asp.
Upon entering Login.asp, a new session variable captures the URL of the referring page, Add_Topic.asp, for later reference:
If (Request.Form("pass")) <> "yes" then
Session("lastpage") = Request.ServerVariables("HTTP_REFERER")
After self-posting, if Login.asp then receives the correct password (yes) it goes to the Else statement which writes:
Session("pass") = "ok"
Response.Redirect("" & Session("lastpage") & "")
The idea is that the page should be redirected to Add_Topic.asp. Instead, it goes back to the Search.asp page.
How do I fix this?