A
Abubakar
Hi,
I have a statement :
Session["username"].ToString();
somewhere in code and of course it gets the username from the session that I
stored earlier. Now I have security configured in the web.config, as :
<authentication mode="Forms">
<forms loginUrl="login.aspx" protection="All">
<credentials passwordFormat="Clear">
<user name ="jack" password="jack"/>
<user name="alan" password="alan"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
when we dont have session, the security code takes care of redirecting the
users to the login page in case they try to access any page without
authentication. But sometimes its happening that in the statament:
Session["username"].ToString();
I get a "object reference not set to instance of an object", which i
completely understand that it couldnt find Session ["username"] and so the
ToString() failed. But my question is if the session no more contains
"username" (it did few minutes back) it means the session got destroyed
right? So that means that asp.net security should not even let this page
execute its code and redirect to the log in page right?
So whats happening, why the execution if no session and the security in
place?
Thanks,
...ab
I have a statement :
Session["username"].ToString();
somewhere in code and of course it gets the username from the session that I
stored earlier. Now I have security configured in the web.config, as :
<authentication mode="Forms">
<forms loginUrl="login.aspx" protection="All">
<credentials passwordFormat="Clear">
<user name ="jack" password="jack"/>
<user name="alan" password="alan"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
when we dont have session, the security code takes care of redirecting the
users to the login page in case they try to access any page without
authentication. But sometimes its happening that in the statament:
Session["username"].ToString();
I get a "object reference not set to instance of an object", which i
completely understand that it couldnt find Session ["username"] and so the
ToString() failed. But my question is if the session no more contains
"username" (it did few minutes back) it means the session got destroyed
right? So that means that asp.net security should not even let this page
execute its code and redirect to the log in page right?
So whats happening, why the execution if no session and the security in
place?
Thanks,
...ab