Page reference in custom IExceptionHandler

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi misters,

I have an application web (asp.net) and I want define custom Handler for
exceptionhandling (Enterprise Library)

My custom class..
[ConfigurationElementType(typeof(CustomHandlerData))]
public class GestorExcepcionesIU : IExceptionHandler


I want to do like this:

Exception IExceptionHandler.HandleException(Exception exception, Guid
handlingInstanceId)
{
RegisterStartupScript(@@@PAGE@@@, "jsExcepcionIU",
"alert('Error IU: " + exception.Message.Replace("'", " ") + "');");
return exception;
}

How I get reference of Page in the custom handler ?

Any help will be appreciated, and I'll be very grateful. Thanks in advance.
Greetings, regards.
 
Is what you need avaible from HttpRequest.Current? Perhaps on the
..Request?

Alternatively there is the Page.Error event and Page.OnError()
method - you might be able to do something with those?

Marc
 
Thanks mister.

I can access to context like this:

HttpContext.Current.Request

but I haven't page reference :(

Any ideas.
 
At a push, cast the .Handler to a Page? since the Page is indeed the
handler... not very elegant, but worth a shot

Page page = HttpContext.Current.Handler as Page;
if (page != null) {
// do something
}

Marc
 
Back
Top