title: If Controller.OnAuthorization() returns void then how do I deny access?
body: <p>I would have expected it to return 'true' or 'false'...</p>
  
  <p>I have overridden OnAuthorization in my Controller and based on a missing or invalid HTTP Header value I want to return 403 forbidden, however I can't seem to figure out how to return anything from OnAuthorization so that it will actually stop the rest of the Controller from running.</p>
  
  <p>What should I do?</p>
  
  <p>My first attempt below was a huge fail, I think Deny() is running but nothing happens...</p>
  
  <pre><code>public class AuthController : Controller
      {
          protected override void OnAuthorization(AuthorizationContext filterContext)
          {
              if (string.IsNullOrEmpty(filterContext.HttpContext.Request.Headers["Authorization"]))
                  Deny();
  
              string authString = filterContext.HttpContext.Request.Headers["Authorization"];
  
              base.OnAuthorization(filterContext);
          }
  
          private ActionResult Deny()
          {
              HttpContext.Response.StatusCode = 403;
  
              return Content("Access Denied", "text/plain");
          }
      }
  </code></pre>
  
  <p><strong>UPDATE</strong> looks like this did the trick, any reason why this might be a bad approach?</p>
  
  <pre><code>    if (string.IsNullOrEmpty(filterContext.HttpContext.Request.Headers["Authorization"]))
      {
          filterContext.Result = Content("Access Denied", "text/plain");
          filterContext.HttpContext.Response.StatusCode = 403;
  
          base.OnAuthorization(filterContext);
      }
  </code></pre>
  
  <p><strong>UPDATE AGAIN</strong> ok so now it's not working at all... I put in a breakpoint and watched it step INTO that if statement, and get to the base.OnAuthorization(...) call, and step right back out again... why would it go into the if statement if it was not executing? If it was executing why would calling base.OnAuthorization(...) not end things early?</p>