I have the following code in an onClick server side event handler:
<script ID="serverEventHandlersVBS" LANGUAGE="vbscript" RUNAT="Server">
Sub btnSubmit_onclick()
session("Location" = Request.Form.Item("lstLocation"
Response.Write session("Location"
session("JobCategory" = Request.Form.Item("lstJobCategory"
Response.Redirect "displayJobs.asp"
End Sub
</script>
It worked just fine, i.e. the session variables were available on the next page, until I included the following file:
<%
sub deleteVariables()
session.Contents.remove("CandID"
session.Contents.remove("UserName"
end sub
if session("CandID" <> "" then
dim helloString
helloString = "<h3>Hello " & session("UserName" & "!</h3>"
helloString = helloString & "If you are not " & session("UserName" & "<br> please "
helloString = helloString & "<a href='default.shtml' onClick='deleteVariables()'>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><a href="profile.shtml">New Users</a> </h3>
<%
end if
%>
This code is included on all pages, but if it's included on the following page it doesn't touch the session variables. Is there something I need to know about server side event handlers that I don't? Does anyone know why this is happening?
<script ID="serverEventHandlersVBS" LANGUAGE="vbscript" RUNAT="Server">
Sub btnSubmit_onclick()
session("Location" = Request.Form.Item("lstLocation"
Response.Write session("Location"
session("JobCategory" = Request.Form.Item("lstJobCategory"
Response.Redirect "displayJobs.asp"
End Sub
</script>
It worked just fine, i.e. the session variables were available on the next page, until I included the following file:
<%
sub deleteVariables()
session.Contents.remove("CandID"
session.Contents.remove("UserName"
end sub
if session("CandID" <> "" then
dim helloString
helloString = "<h3>Hello " & session("UserName" & "!</h3>"
helloString = helloString & "If you are not " & session("UserName" & "<br> please "
helloString = helloString & "<a href='default.shtml' onClick='deleteVariables()'>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><a href="profile.shtml">New Users</a> </h3>
<%
end if
%>
This code is included on all pages, but if it's included on the following page it doesn't touch the session variables. Is there something I need to know about server side event handlers that I don't? Does anyone know why this is happening?