To require user authentication for all action methods on all controllers please add theĀ AuthorizeAttribute
class to the App_Start/FilterConfig.cs file:
public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new AuthorizeAttribute()); }
To configure an exception and allow anonymous access to an action method: Decorate it with theĀ AllowAnonymous
attribute:
[AllowAnonymous] public ActionResult Index() { // do stuff }