Sorry for the stupid question but I cannot see what I am doing wrong. I found this code to password protect our ASP pages and it works fine but I am trying to pass a variable between pages so I get re-directed to the page I want. I just cannot figure out what I am doing wrong.
Here is the code at the top of the first page. I added the "?Page=linkspda .asp" part
This does take me to the login.asp page and in the address bar on the browser it shows the "http://mywebsite.somew here.com/login.asp?Page= linkspda.asp"
The login.asp page looks like this:
After the "Sub CheckLoginForm" I added the line:
testvar = Request.QuerySt ring("Page")
and
Response.Redire ct testvar
The Response.Redire ct was just:
Response.Redire ct "linkspda.a sp"
The Request.QuerySt ring("Page") does not seem to contain anything.
What am I doing wrong?
Thanks,
Scott
Here is the code at the top of the first page. I added the "?Page=linkspda .asp" part
Code:
<%
If Session("BlnLoggedIn") <> True Then
Response.Redirect("http://mywebsite.somewhere.com/login.asp?Page=linkspda.asp")
End If
%>
The login.asp page looks like this:
Code:
<%
Response.Expires = -1000 'Make sure the browser doesn't cache this page
Response.Buffer = True 'enables our response.redirect to work
%>
<html>
<head><title>Password Protect your ASP pages</title>
</head>
<body>
<%
If Request.Form("submit") ="Login" Then
CheckLoginForm
Else
ShowLoginForm
End If
%>
<%
Sub CheckLoginForm
testvar = Request.QueryString("Page")
'check if the value of the text field 'username' and 'password' are correct
If Request.Form("username") = "test" AND Request.Form("password") = "pass" Then
Session("BlnLoggedIn") = True
Response.Redirect testvar
Else
Response.Write "<div align='center'>You are not logged in.</div><br>"
ShowLoginForm
End If
End Sub
%>
<% Sub ShowLoginForm %>
<div align='center'>
<!-- start the HTML login form -->
<form name="form" action="login.asp" method="post">
<table>
<tr>
<td><font size="8">User Name :</font></td>
<td><input type="text" style="font-size:48px" name="username"></td></tr>
<tr>
<td><font size="8">Password : </font></td>
<td><input type="password" style="font-size:48px" name="password"></td></tr>
<tr><td colspan="2"><input type="submit" style="font-size:48px" name="submit" value="Login"></td></tr>
</table>
</form>
<!-- end the HTML login form -->
</div>
<% End Sub %>
</body>
</html>
testvar = Request.QuerySt ring("Page")
and
Response.Redire ct testvar
The Response.Redire ct was just:
Response.Redire ct "linkspda.a sp"
The Request.QuerySt ring("Page") does not seem to contain anything.
What am I doing wrong?
Thanks,
Scott
Comment