I have a 2 base classes that do error handling -- one for pages
(System.Web.UI.Page) and one for applications (System.Web.HttpApplication,
Global.asax uses it).
Are there any situations in either of these error handlers where
HttpContext.Current would be null?
Page Error Handler
public class PageBase : System.Web.UI.Page {
protected override void OnError(EventArgs e) {
HttpContext ctx = HttpContext.Current;
if (ctx == null) {
// is this even possible?
}
}
Application Error Handler
public class GlobalBase : System.Web.HttpApplication {
protected void Application_Error(Object sender, EventArgs e) {
HttpContext ctx = HttpContext.Current;
if (ctx == null) {
// how about this situation? is this possible?
}
}
}
If the context could be null in either situation, then I wouldn't be able to
get the exception information anyway. Should I just log it and return?