At the top of my menu, I have some code to check if the user is logged in by way of session variable, and if so, hello User. Otherwise, it will display a login box.
The problem is that when I get to the first place where the session variable would and should be <> "", the code seems to be killing the session variable, and my error message of if session("CandID"
= "" then
response.write "You must be logged in to update your profile."
etc.
fires, even though I know on the page before the session variable was hale and hearty.
Here's the code. Can someone please find my mistake?
<%
if session("CandID"
<> "" then
dim helloString
helloString = "Hello " & session("CandID"
& "!"
helloString = helloString & "If you are not " & session("CandID"
& "please "
helloString = helloString & "<a href='default.shtml'>log in.</a>"
Response.Write helloString
else
%>
<h3>Already a member? <br>Login now.</h3>
<form action="validatePassword.asp" method="get" name="frmLogin">
<table>
<tr>
<td>Username: </td></tr>
<tr>
<td><input id="text1" name="txtUserName"></td></tr>
<tr>
<td>Password: </td></tr>
<tr>
<td><input type="password" id="password1" name="txtPassword"></td></tr>
</table>
<input type="image" src="images/img_Submit.gif" value="Submit" id="submit1" name="btnSubmit" WIDTH="106" HEIGHT="54">
</form>
<h3>New User? <a href="profile.shtml">Click Here</a> </h3>
<%
end if
%>
The problem is that when I get to the first place where the session variable would and should be <> "", the code seems to be killing the session variable, and my error message of if session("CandID"
response.write "You must be logged in to update your profile."
etc.
fires, even though I know on the page before the session variable was hale and hearty.
Here's the code. Can someone please find my mistake?
<%
if session("CandID"
dim helloString
helloString = "Hello " & session("CandID"
helloString = helloString & "If you are not " & session("CandID"
helloString = helloString & "<a href='default.shtml'>log in.</a>"
Response.Write helloString
else
%>
<h3>Already a member? <br>Login now.</h3>
<form action="validatePassword.asp" method="get" name="frmLogin">
<table>
<tr>
<td>Username: </td></tr>
<tr>
<td><input id="text1" name="txtUserName"></td></tr>
<tr>
<td>Password: </td></tr>
<tr>
<td><input type="password" id="password1" name="txtPassword"></td></tr>
</table>
<input type="image" src="images/img_Submit.gif" value="Submit" id="submit1" name="btnSubmit" WIDTH="106" HEIGHT="54">
</form>
<h3>New User? <a href="profile.shtml">Click Here</a> </h3>
<%
end if
%>