code_junkie

Passing Exceptions to an error screen in ASP.net/C#

Nov 11th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <customErrors mode="RemoteOnly" defaultRedirect="/error.html">
  2. <error statusCode="403" redirect="/accessdenied.html" />
  3. <error statusCode="404" redirect="/pagenotfound.html" />
  4. </customErrors>
  5.  
  6. Server.GetLastError();
  7.  
  8. protected void Application_Error(object sender, EventArgs e)
  9. {
  10. Exception ex = Server.GetLastError();
  11. this.Session[CacheProvider.ToCacheKey(CacheKeys.LastError)] = ex;
  12. }
Add Comment
Please, Sign In to add comment