Created
April 13, 2013 07:59
-
-
Save eirikb/5377529 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Application_PreRequestHandlerExecute() | |
{ | |
if (!(Context.Handler is IRequiresSessionState)) return; | |
var authenticationCookie = Request.Cookies[FormsAuthentication.FormsCookieName]; | |
if (authenticationCookie == null) return; | |
var authenticationTicket = FormsAuthentication.Decrypt(authenticationCookie.Value); | |
if (authenticationTicket == null || authenticationTicket.Expired) return; | |
if (Membership.GetUser() != null) return; | |
FormsAuthentication.SignOut(); | |
Response.Redirect(FormsAuthentication.LoginUrl, true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment