locked
HttpModule Error event doesnt fire in webservice RRS feed

  • Question

  • User-1505052757 posted

    Hi,

    I have created a HttpModule and implemented an event that needs to be fired on error like this:

    --------------------------------

    public void
    Init(HttpApplication app) { app.Error += new System.EventHandler(OnError); throw new Exception("This is not handled to the event"); } private void OnError(object obj, EventArgs args) { // This never happens... }
    --------------------------------
    Why doesnt this work?

    regards
    Tuesday, August 14, 2007 10:01 AM

All replies

  • User-225114762 posted

    I think you're a little fast in trying your new event handler. Try throwing your exception in code that is actually executed for a request, perhaps in Page_Load of your default startup-page.

    Also - why are you doing this in your own HttpModule? What's wrong with the global Application_Error event method? Are you trying to catch exceptions that originate in the HttpModule? I don't think you want to do that so.

    Tuesday, August 14, 2007 10:51 AM
  • User-1505052757 posted

    Hi,

    Regarding the actual location of the exception, the above should definately work, but as a reference I can tell that the event is never fired - regardless of where its generated in the application.

    As far as the Application_Error goes - well that event does not apply for webservices. Hmm maybe thats related...

     

    Tuesday, August 14, 2007 3:54 PM