title: Set 403 error page in MVC
body: <p>I overrides the class to perform custom Authorization </p>
  
  <pre><code>[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
  public class AuthorizeAttribute : System.Web.Mvc.AuthorizeAttribute
  {
      protected override void HandleUnauthorizedRequest(System.Web.Mvc.AuthorizationContext filterContext)
      {
          if (filterContext.HttpContext.Request.IsAuthenticated)
          {
              filterContext.Result = new System.Web.Mvc.HttpStatusCodeResult(403);
          }
          else
          {
              base.HandleUnauthorizedRequest(filterContext);
          }
      }
  }
  </code></pre>
  
  <p>now in web.config i have configured the 403 error page </p>
  
  <pre><code>&lt;customErrors defaultRedirect="/Shared/Error" mode="On"&gt;
    &lt;error statusCode="403" redirect="/Shared/UnAuthorize" /&gt;
  &lt;/customErrors&gt;
  </code></pre>
  
  <p>but the browser still shows me default error page for 403,
  what i am missing here, any idea</p>