title: MVC4: When to redirect failed login
body: <p>I am using MVC4 with <strong>Windows Authentication</strong> for an Intranet site.</p>
  
  <p>My <strong>Controllers</strong> are based on my <strong>BaseController</strong></p>
  
  <p><strong>BaseController</strong> will call out to a service to see if the Windows user is allowed to use the site. If not, I want to redirect them to "Index" on the Controller "UnAuthorized"</p>
  
  <p>Where in the <strong>BaseController</strong> would I check and then how would I redirect the request to the UnAuthorized controller?</p>
  
  <p>I have tried to redirect in the <strong>OnAuthorized</strong> like this but nothing happens:</p>
  
  <pre><code>    protected override void OnAuthorization(AuthorizationContext filterContext)
      {
          base.OnAuthorization(filterContext);
  
          if (!isAuthorized(username))
              RedirectToAction("Index", "UnAuthorized");
      }
  </code></pre>