Notas del Terrible
Terrible Bore

ASP.NET cookie

March 18, 2010 11:01 by terR0Q

Small tip on using ASP.NET authentication.

When you use custom ticket in ASP.NET authorization process (that’s the case for «Remember me»), you must not use FormsAuthentication.RedirectFromLoginPage(...) to redirect user on originally requested page: this will recreate cookie and remove custom ticket resulting in much shorter cookie expiration period (that is defined in web.config forms authentication node). In this case you should make explicit redirect on original URL, like this:

Response.Redirect( FormsAuthentication.GetRedirectUrl( login, isRemember ), true );

That’s a small bit, but can take 10 minutes at minimum to find out.


Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading