title: ASP.NET custom error page - Server.GetLastError() is null
body: <p>I have a custom error page set up for my application:</p>
  
  <pre><code>&lt;customErrors mode="On" defaultRedirect="~/errors/GeneralError.aspx"
  /&gt;
  </code></pre>
  
  <p>In Global.asax, Application_Error(), the following code works to get the exception details:</p>
  
  <pre><code>  Exception ex = Server.GetLastError();
    if (ex != null)
      {
          if (ex.GetBaseException() != null)
              ex = ex.GetBaseException();
      }
  </code></pre>
  
  <p>By the time I get to my error page (~/errors/GeneralError.aspx.cs), Server.GetLastError() is null</p>
  
  <p>Is there any way I can get the exception details on the Error Page, rather than in Global.asax.cs ?</p>
  
  <p>ASP.NET 3.5 on Vista/IIS7</p>