title: Is it possible to disable authentication Filter on one action in an MVC 5 controller?
body: <pre><code>[AuthenticateUser]
  public class HomeController : Controller
  {
      //
      // GET: /Home/
      public ActionResult Index()
      {
          return View();
      }
  
      [AllowAnonymous]
      public ActionResult List()
      {
          return View();
      }
  }
  </code></pre>
  
  <p>How to remove authentication for action named as List? Please advise....</p>
  
  <p>My Custom Filter coding as follow.. i have inherited the FilterAttribute call as well. 
  Please advise regarding</p>
  
  <pre><code>public class AuthenticateUserAttribute: FilterAttribute, IAuthenticationFilter
  {
      public void OnAuthentication(AuthenticationContext context)
      {
          if (this.IsAnonymousAction(context))
          {
  
          }
  
          if (user == "user")
          {
              // do nothing
          }
          else
          {
              context.Result = new HttpUnauthorizedResult(); // mark unauthorized
          }
      }
  
      public void OnAuthenticationChallenge(AuthenticationChallengeContext context)
      {
          if (context.Result == null || context.Result is HttpUnauthorizedResult)
          {
              context.Result = new RedirectToRouteResult("Default",
                  new System.Web.Routing.RouteValueDictionary{
                      {"controller", "Home"},
                      {"action", "List"},
                      {"returnUrl", context.HttpContext.Request.RawUrl}
                  });
          }
      }
  }
  </code></pre>
  
  <p>The below code generate the error message : Error   1   The best overloaded method match for 'MVC5Features.Filters.AuthenticateUserAttribute.IsAnonymousAction(System.Web.Mvc.AuthorizationContext)' has some invalid arguments c:\users\kirupananthan.g\documents\visual studio 2013\Projects\MVC5Features\MVC5Features\Filters\AuthenticateUserAttribute.cs   16  17  MVC5Features
  Error   2   Argument 1: cannot convert from 'System.Web.Mvc.Filters.AuthenticationContext' to 'System.Web.Mvc.AuthorizationContext' c:\users\kirupananthan.g\documents\visual studio 2013\Projects\MVC5Features\MVC5Features\Filters\AuthenticateUserAttribute.cs   16  40  MVC5Features</p>
  
  <pre><code>if (this.IsAnonymousAction(context))
  </code></pre>