Last post Nov 30, 2007 11:55 AM by cagreen
Nov 29, 2007 05:14 PM|cagreen|LINK
I've been scratching my head over this for a bit, I hope someone can help me out.
I have an HttpModule to handle my exceptions. I have an OnError method which basically looks like this:
public void OnError(object obj, EventArgs args)
HttpContext ctx = HttpContext.Current;
Exception exception = ctx.Server.GetLastError();
//clear error so that it bubbles up to the error page
My web.config's customerror tag properly defines the defaultRedirect attribute. My error page is dynamic and will include some exception information. My problem is that I have multiple app domains that I need to service and I can't seem to get the Exception
from the HttpModule back to the aspx page.
I can see the exception in the HttpContext from the HttpModule but it's gone in the aspx page (when going across domains).
I could dynamically render my page using Response.Write (eeeewwwwww!).
What's happening under the covers to the my request after it has left the httpmodule?
Any ideas to get the exception to the error page?
httpmodule redirect rewrite "client portal"
Nov 29, 2007 08:55 PM|Mercury082|LINK
You can append whatever info from the exception you require to the query string of your error page and do a manual response.redirect in the OnError method of your HttpModule. Does your error page actually need the exception for processing? If so, is that
something that can perhaps be taken care of in the HttpModule and leave the error page just for display purposes?
Nov 30, 2007 11:47 AM|cagreen|LINK
I was hoping that there would be a cleaner way to do it, but this could work too.
But I'm having trouble implementing it...
Everything works great when the exception occurs in the same app domain as my error page. But when the exception occurs in a different app domain than the error page then I'm not redirected to the error page. In fact, the page which initially threw the error
attempts to reload.
I'm using Response.Redirect, not Server.Transfer, and I'm using an absolute URL.
Nov 30, 2007 11:55 AM|cagreen|LINK
A bit more info.... it does work across app domains.
It appears as though the page was attempting to perform some additional processing and throwing the same error again. I used Response.End thinking that was halt executing of the page.
Is there anyway to force the initial page to abort and then redirect?