Re: Non persistent cookie timeout?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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.

.



Relevant Pages

  • Re: FormsAuthentication cookies timeout
    ... matter what I set the timeout field to - maybe this field will not help me). ... I would actually like the cookie for each person to ... disapear when they leave the browser. ... I was looking on the MS site about cookies and they say that the expiration ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: FormsAuthentication cookies timeout
    ... in ur web.config the default timeout is 20mins. ... Why don't u change it to ur taste.. ... If the browser closes, I ... > want the cookie to disappear. ...
    (microsoft.public.dotnet.framework.aspnet)
  • FormsAuthentication cookies timeout
    ... I am trying to get my authentication to work and want the timeout to be 30 ... If the browser closes, I ... The 2 web configs are set as: ... My problem is during testing the cookie gets turned on and I have to wait ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Attempt to de-mystify AJAX
    ... "Hyperlinks" always open a new browser window. ... key (cookie) is still there and still contains the original value. ... You can get the cookies from the HTTP_COOKIE CGI environment variable. ...
    (comp.databases.pick)
  • Re: NSA Used Cookies to Track Visitors Web Activities?
    ... Could unwittingly installing a compromised browser open the doors wide to cookie-based intrusions? ... A cookie itself is unlikely to be a virus, but if the browser code is written in C, it is very likely to have arrays that are susceptible to "buffer overrun" Sometimes a clever enough person can use such a bug to cause executable code stored in an allegedly non-executable file to replace code in your browser or operating system. ... an external intruder coming in over an Internet connection, presumably that intruder would have access to the cookies on one's machine. ...
    (comp.sys.mac.system)