Re: Non persistent cookie timeout?
- From: bashful.belle@xxxxxxxxx
- Date: 13 Jan 2006 10:35:08 -0800
I'm using the cookie for timeout.....but unless I close the browser a
timeout never occurs!
ok, a stupid question here, but Do i need to explicitly check for a
cookie timeout, or will the "Application_AuthenticateRequest" in
global.asax take care of it.
Please have a look at my global.asax for my app:
protected void Application_AuthenticateRequest(Object sender, EventArgs
e)
{
// Extract the forms authentication cookie
string cookieName = FormsAuthentication.FormsCookieName;
HttpCookie authCookie = Context.Request.Cookies[cookieName];
if(null == authCookie)
{
// There is no authentication cookie.
return;
}
FormsAuthenticationTicket authTicket = null;
try
{
authTicket = FormsAuthentication.Decrypt(authCookie.Value);
}
catch(Exception ex)
{
// Log exception details (omitted for simplicity)
return;
}
if (null == authTicket)
{
// Cookie failed to decrypt.
return;
}
// When the ticket was created, the UserData property was assigned a
// pipe delimited string of group names.
String[] groups = authTicket.UserData.Split(new char[]{'|'});
// Create an Identity object
GenericIdentity id = new
GenericIdentity(authTicket.Name,"LdapAuthentication");
// This principal will flow throughout the request.
GenericPrincipal principal = new GenericPrincipal(id, groups);
// Attach the new principal object to the current HttpContext object
Context.User = principal;
}
Thanks.
.
- References:
- Non persistent cookie timeout?
- From: bashful . belle
- Re: Non persistent cookie timeout?
- From: S. Justin Gengo [MCP]
- Re: Non persistent cookie timeout?
- From: bashful . belle
- Re: Non persistent cookie timeout?
- From: S. Justin Gengo [MCP]
- Re: Non persistent cookie timeout?
- From: bashful . belle
- Re: Non persistent cookie timeout?
- From: S. Justin Gengo [MCP]
- Re: Non persistent cookie timeout?
- From: bashful . belle
- Re: Non persistent cookie timeout?
- From: S. Justin Gengo [MCP]
- Non persistent cookie timeout?
- Prev by Date: Re: Maintaining ASP.NET Sites
- Next by Date: Re: Class based on singleton pattern and instance methods in that
- Previous by thread: Re: Non persistent cookie timeout?
- Next by thread: asp:login and lockout condition
- Index(es):
Relevant Pages
|