title: How to make Authorize attribute return custom 403 error page instead of redirecting to the Logon page
body: <p><code>[Authorize]</code> attribute is nice and handy MS invention, and I hope it can solve the issues I have now</p>
  
  <p>To be more specific:</p>
  
  <p>When current client isn't authenticated - <code>[Authorize]</code> redirects from secured action to logon page and after logon was successful - brings user back, this is good.</p>
  
  <p>But when current client already authenticated but not authorized to run specific action - all I need is to just display my general 403 page.</p>
  
  <p>Is it possible without moving authorization logic within controller's body?</p>
  
  <p><strong>Update</strong>: 
  The behavior I need in should be semantically equals to this sketch:</p>
  
  <pre><code>public ActionResult DoWork()
  {
      if (!NotAuthorized())
      {
          // this should be not redirect, but forwarding 
          return RedirectToAction("403");         
      }
  
      return View();
  }
  </code></pre>
  
  <p>so - there should no any redirect and url should be stay the same, but contents of the page should be replaced with 403-page</p>
  
  <p><strong>Update 2</strong>: I implemented sketch in this way:</p>
  
  <pre><code>[HandleError]
  public class HomeController : Controller
  {
      public ActionResult Index()
      {
          ViewData["Message"] = "Welcome to ASP.NET MVC!";
  
          return View();
      }
  
      [CustomActionFilter]
      public ActionResult About()
      {
          return View();
      }
  
      public ActionResult Error_403()
      {
          return Content("403");
      }
  }
  
  public class CustomActionFilter : ActionFilterAttribute
  {
      public override void OnActionExecuting(ActionExecutingContext filterContext)
      {
          filterContext.Result = new ContentResult { Content = "403" };
      }
  }
  </code></pre>
  
  <p>And can't get how to properly forward execution to HomeController.Action_403() so it display 403.</p>
  
  <p><strong>Update 3</strong>:</p>
  
  <pre><code>filterContext.Result = new ViewResult() { ViewName = "Error_403" };
  </code></pre>
  
  <p>so this is an answer on how to render specific view template... but still have no idea how to run another controller - anyway, it's enough good solution.</p>