title: How to display a generic error page in Asp.Net MVC 2
body: <p>I have the following in my base controller:</p>
  
  <pre><code>    protected override void OnException(ExceptionContext filterContext)
      {
          if (filterContext == null)
          {
              throw new ArgumentNullException("filterContext");
          }
  
          // If custom errors are disabled, we need to let the normal ASP.NET exception handler
          // execute so that the user can see useful debugging information.
          if (filterContext.ExceptionHandled || !filterContext.HttpContext.IsCustomErrorEnabled)
          {
              return;
          }
  
          Exception exception = filterContext.Exception;
  
          // If this is not an HTTP 500 (for example, if somebody throws an HTTP 404 from an action method),
          // ignore it.
          if (new HttpException(null, exception).GetHttpCode() != 500)
          {
              return;
          }
          // TODO: What is the namespace for ExceptionType?
          //if (!ExceptionType.IsInstanceOfType(exception))
          //{
          //    return;
          //}
  
          // Send Email
          MailException(exception);
  
          // TODO: What does this line do?
          base.OnException(filterContext);
  
          filterContext.Result = new ViewResult
          {
              ViewName = "Error"
          };
          filterContext.ExceptionHandled = true;
          filterContext.HttpContext.Response.Clear();
          filterContext.HttpContext.Response.StatusCode = 500;
      }
  </code></pre>
  
  <p>In my Shared folder, I have an Error.aspx View.</p>
  
  <p>Web.config</p>
  
  <pre><code>&lt;customErrors mode="On" /&gt;
  </code></pre>
  
  <p>I am still seeing the yellow screen when an exception occurs. What am I doing incorrectly?</p>