title: ASP.NET customErrors with mode=remoteOnly and global.asax handling exceptions
body: <p>I have custom errors set in the web config file as follows:</p>
  
  <pre><code>&lt;customErrors mode="RemoteOnly" defaultRedirect="GenericError.aspx" /&gt;
  </code></pre>
  
  <p>Fine and dandy... I like that mode="RemoteOnly" facilitates development...</p>
  
  <p>For unhandled exceptions, I have in global.asax:</p>
  
  <pre><code>Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
      Response.Redirect("GenericError.aspx")
  End Sub
  </code></pre>
  
  <p>However, unhandled exceptions are going to the generic error page instead of the informative yellow screen of death preferred by developers. I can comment out the redirect in global.asax, but then I need to remember to change it for the production environment. Is there a way I can check in Application_Error whether I am remote or not to determine whether to redirect?</p>