How can I pass some data from a Global.asax event handler to a custom error page in ASP.NET without using Server.Transfer or some redirect?
+1
A:
Assuming you're catching unhandled exceptions in global.asax, I don't think you can. You're no longer in anyone's session at that point, so you've lost just about all connection with the error, other than the exception itself.
You might try catching unhandled exceptions in each page, by adding a handler for the Page_Error event. You can centralize some of that by having each page subclass your own application "page base" class instead of System.Web.UI.Page, and make sure that your "page base" class inherits from System.Web.UI.Page. Then have your page base class handle Page_Error. But you won't be in page-specific code at that point, so you'll still have to figure out a method for passing data to that custom error page.
Cylon Cat
2010-05-24 20:57:00