winform security: strange error, where as I expected a redirect
- From: "Abubakar" <noemail@xxxxxxxxxxx>
- Date: Wed, 17 Jun 2009 12:25:28 +0900
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
.
- Follow-Ups:
- Re: winform security: strange error, where as I expected a redirect
- From: bruce barker
- Re: winform security: strange error, where as I expected a redirect
- Prev by Date: Re: Detailsview updading issue
- Next by Date: RE: Temporary ASP.NET Files Corruption
- Previous by thread: Is there a way to keep the StreamWriter open?
- Next by thread: Re: winform security: strange error, where as I expected a redirect
- Index(es):
Relevant Pages
|