LandMonster
Programmer
I'm trying to use a session variable to limit access to a page on my site. when a user logs in, I set the var to true. then on the protected page I check the variable for false. if false I redirect back to the login page. The problem is, when I try to check that var, my page won't load. here is my code:
global.asa
______________________________________________
<script language="vbscript" runat="server">
sub Application_OnStart
end sub
sub Application_OnEnd
end sub
sub Session_OnStart
session("sValid"=FALSE
end sub
sub Session_OnEnd
end sub
</script>
login.asp
___________________________________________________
session("sValid"=TRUE
Response.Redirect("post.asp"
'This is the snippet of code where I set my session variable
post.asp
_____________________________________________________
<%
If Session("sValid" = FALSE Then
Response.Redirect ("login.asp"
Else
Response.Write "<!-- Validated at " & cstr(Now()) & " -->"
End If
%>
Without that bit of code in my post page it loads fine, writes to the db and all that good stuff. But when I try to open the page with this code it in, it gives me an error and won't load at all.
Can somebody let me know what I'm doing wrong?
Thanks
global.asa
______________________________________________
<script language="vbscript" runat="server">
sub Application_OnStart
end sub
sub Application_OnEnd
end sub
sub Session_OnStart
session("sValid"=FALSE
end sub
sub Session_OnEnd
end sub
</script>
login.asp
___________________________________________________
session("sValid"=TRUE
Response.Redirect("post.asp"
'This is the snippet of code where I set my session variable
post.asp
_____________________________________________________
<%
If Session("sValid" = FALSE Then
Response.Redirect ("login.asp"
Else
Response.Write "<!-- Validated at " & cstr(Now()) & " -->"
End If
%>
Without that bit of code in my post page it loads fine, writes to the db and all that good stuff. But when I try to open the page with this code it in, it gives me an error and won't load at all.
Can somebody let me know what I'm doing wrong?
Thanks