Skip to content

Instantly share code, notes, and snippets.

@jbubriski
Last active December 16, 2015 12:39
Show Gist options
  • Save jbubriski/5435902 to your computer and use it in GitHub Desktop.
Save jbubriski/5435902 to your computer and use it in GitHub Desktop.
Custom Authorization in ASP.NET MVC through a custom Authorization attribute.
public class CustomAuthorizeAttribute : System.Web.Mvc.AuthorizeAttribute
{
protected override void HandleUnauthorizedRequest(System.Web.Mvc.AuthorizationContext filterContext)
{
// Clear Cookies
// Put your code here
base.HandleUnauthorizedRequest(filterContext);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment