Re: Exception not being displayed

Discussion in 'ASP .Net' started by Scott Allen, Sep 21, 2004.

  1. Scott Allen

    Scott Allen Guest

    Hi Marty:

    By "code in an assembly" do you mean code that is outside of the Page
    class? Are you catching the exception to log the information or
    waiting for it to bubble into the Error event of the Page or
    HttpApplication class?

    --
    Scott
    http://www.OdeToCode.com

    On Tue, 21 Sep 2004 11:49:07 -0700, "Marty U."
    <> wrote:

    >The subject is a bit vague but here is my situation:
    >
    >I wrote an object that does error reporting in applications. It allows me to
    >send an email and/or store the information in a database should my try catch
    >routine experience an exception. This all works fine, if configured I receive
    >the emails and it gets stored in the database. However, if the error occurs
    >within an assembly the page does not catch the exception, why?
    >
    >I discovered this by forgetting to set security on a SP and I received an
    >email but the page appeared to process just fine.
    >
    >Why doesn't my page catch routine see the object exception on the sp?
    Scott Allen, Sep 21, 2004
    #1
    1. Advertising

  2. Yes it is outside the Page class.

    In the meantime I thought of a different approach by using the Global.asax
    and trapping the Application_OnError event and then executing my custom
    object.

    This does not work if the error is in a custom assembly.

    My goal is to record the error in a database, send me an email that it
    happened, and display to the user that the error occurred and the ID of the
    error from the DB. Everything functions except getting the error message to
    the user.

    I want to catch any and all errors at any point in time that happen in the
    application regardless of type. I don't mind doing try,catch,finally on every
    routine but I need to be guaranteed that I am capturing all the errors.

    Thanks for your response.

    "Scott Allen" wrote:

    > Hi Marty:
    >
    > By "code in an assembly" do you mean code that is outside of the Page
    > class? Are you catching the exception to log the information or
    > waiting for it to bubble into the Error event of the Page or
    > HttpApplication class?
    >
    > --
    > Scott
    > http://www.OdeToCode.com
    >
    > On Tue, 21 Sep 2004 11:49:07 -0700, "Marty U."
    > <> wrote:
    >
    > >The subject is a bit vague but here is my situation:
    > >
    > >I wrote an object that does error reporting in applications. It allows me to
    > >send an email and/or store the information in a database should my try catch
    > >routine experience an exception. This all works fine, if configured I receive
    > >the emails and it gets stored in the database. However, if the error occurs
    > >within an assembly the page does not catch the exception, why?
    > >
    > >I discovered this by forgetting to set security on a SP and I received an
    > >email but the page appeared to process just fine.
    > >
    > >Why doesn't my page catch routine see the object exception on the sp?

    >
    >
    =?Utf-8?B?TWFydHkgVS4=?=, Sep 21, 2004
    #2
    1. Advertising

  3. Scott Allen

    Scott Allen Guest

    Hi Marty:

    Application_OnError is a perfect place for a global error handler.

    What I don't understand is why the Page Error event doesn't fire for
    you. If there is an exception during the page processing it certainly
    should fire, unless there is a catch statement somewhere that is not
    letting the exception propogate up. It should work even if the code is
    in another assembly - even in a different language.

    --
    Scott
    http://www.OdeToCode.com

    On Tue, 21 Sep 2004 12:45:05 -0700, "Marty U."
    <> wrote:

    >Yes it is outside the Page class.
    >
    >In the meantime I thought of a different approach by using the Global.asax
    >and trapping the Application_OnError event and then executing my custom
    >object.
    >
    >This does not work if the error is in a custom assembly.
    >
    >My goal is to record the error in a database, send me an email that it
    >happened, and display to the user that the error occurred and the ID of the
    >error from the DB. Everything functions except getting the error message to
    >the user.
    >
    >I want to catch any and all errors at any point in time that happen in the
    >application regardless of type. I don't mind doing try,catch,finally on every
    >routine but I need to be guaranteed that I am capturing all the errors.
    >
    >Thanks for your response.
    >
    >"Scott Allen" wrote:
    >
    Scott Allen, Sep 21, 2004
    #3
  4. Global.cs events do not propagate to the page. Also I have experienced some
    delegate calls not rolling up to the page and only caught in the
    Application_OnError.

    I have implemented both Page_Error and Application_OnError. That way
    nothing gets through. I haven't had any problems catching exceptions in
    another assembly, but not always at the page level. (That is where the
    reflected calls seemed to die)

    HTH,

    bill

    "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    news:...
    > Hi Marty:
    >
    > Application_OnError is a perfect place for a global error handler.
    >
    > What I don't understand is why the Page Error event doesn't fire for
    > you. If there is an exception during the page processing it certainly
    > should fire, unless there is a catch statement somewhere that is not
    > letting the exception propogate up. It should work even if the code is
    > in another assembly - even in a different language.
    >
    > --
    > Scott
    > http://www.OdeToCode.com
    >
    > On Tue, 21 Sep 2004 12:45:05 -0700, "Marty U."
    > <> wrote:
    >
    > >Yes it is outside the Page class.
    > >
    > >In the meantime I thought of a different approach by using the

    Global.asax
    > >and trapping the Application_OnError event and then executing my custom
    > >object.
    > >
    > >This does not work if the error is in a custom assembly.
    > >
    > >My goal is to record the error in a database, send me an email that it
    > >happened, and display to the user that the error occurred and the ID of

    the
    > >error from the DB. Everything functions except getting the error message

    to
    > >the user.
    > >
    > >I want to catch any and all errors at any point in time that happen in

    the
    > >application regardless of type. I don't mind doing try,catch,finally on

    every
    > >routine but I need to be guaranteed that I am capturing all the errors.
    > >
    > >Thanks for your response.
    > >
    > >"Scott Allen" wrote:
    > >

    >
    William F. Robertson, Jr., Sep 21, 2004
    #4
  5. Ahhhh Yes, dumb me, I had built a try catch routine into my assemblies which
    was catching the error before it got to the page level.

    Thanks for tickling the thinker!

    "William F. Robertson, Jr." wrote:

    > Global.cs events do not propagate to the page. Also I have experienced some
    > delegate calls not rolling up to the page and only caught in the
    > Application_OnError.
    >
    > I have implemented both Page_Error and Application_OnError. That way
    > nothing gets through. I haven't had any problems catching exceptions in
    > another assembly, but not always at the page level. (That is where the
    > reflected calls seemed to die)
    >
    > HTH,
    >
    > bill
    >
    > "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    > news:...
    > > Hi Marty:
    > >
    > > Application_OnError is a perfect place for a global error handler.
    > >
    > > What I don't understand is why the Page Error event doesn't fire for
    > > you. If there is an exception during the page processing it certainly
    > > should fire, unless there is a catch statement somewhere that is not
    > > letting the exception propogate up. It should work even if the code is
    > > in another assembly - even in a different language.
    > >
    > > --
    > > Scott
    > > http://www.OdeToCode.com
    > >
    > > On Tue, 21 Sep 2004 12:45:05 -0700, "Marty U."
    > > <> wrote:
    > >
    > > >Yes it is outside the Page class.
    > > >
    > > >In the meantime I thought of a different approach by using the

    > Global.asax
    > > >and trapping the Application_OnError event and then executing my custom
    > > >object.
    > > >
    > > >This does not work if the error is in a custom assembly.
    > > >
    > > >My goal is to record the error in a database, send me an email that it
    > > >happened, and display to the user that the error occurred and the ID of

    > the
    > > >error from the DB. Everything functions except getting the error message

    > to
    > > >the user.
    > > >
    > > >I want to catch any and all errors at any point in time that happen in

    > the
    > > >application regardless of type. I don't mind doing try,catch,finally on

    > every
    > > >routine but I need to be guaranteed that I am capturing all the errors.
    > > >
    > > >Thanks for your response.
    > > >
    > > >"Scott Allen" wrote:
    > > >

    > >

    >
    >
    >
    =?Utf-8?B?TWFydHkgVS4=?=, Sep 22, 2004
    #5
  6. Scott Allen

    Scott Allen Guest

    Bill:
    Yes, thats true. Many of the events inside of Global happen before and
    after Page processing.

    Marty:
    Glad to know you found the issue.

    --
    Scott
    http://www.OdeToCode.com

    On Tue, 21 Sep 2004 16:31:58 -0500, "William F. Robertson, Jr."
    <wfrobertson_at_kpmg_dot_com> wrote:

    >Global.cs events do not propagate to the page. Also I have experienced some
    >delegate calls not rolling up to the page and only caught in the
    >Application_OnError.
    >
    >I have implemented both Page_Error and Application_OnError. That way
    >nothing gets through. I haven't had any problems catching exceptions in
    >another assembly, but not always at the page level. (That is where the
    >reflected calls seemed to die)
    >
    >HTH,
    >
    >bill
    >
    >"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    >news:...
    >> Hi Marty:
    >>
    >> Application_OnError is a perfect place for a global error handler.
    >>
    >> What I don't understand is why the Page Error event doesn't fire for
    >> you. If there is an exception during the page processing it certainly
    >> should fire, unless there is a catch statement somewhere that is not
    >> letting the exception propogate up. It should work even if the code is
    >> in another assembly - even in a different language.
    >>
    >> --
    >> Scott
    >> http://www.OdeToCode.com
    >>
    >> On Tue, 21 Sep 2004 12:45:05 -0700, "Marty U."
    >> <> wrote:
    >>
    >> >Yes it is outside the Page class.
    >> >
    >> >In the meantime I thought of a different approach by using the

    >Global.asax
    >> >and trapping the Application_OnError event and then executing my custom
    >> >object.
    >> >
    >> >This does not work if the error is in a custom assembly.
    >> >
    >> >My goal is to record the error in a database, send me an email that it
    >> >happened, and display to the user that the error occurred and the ID of

    >the
    >> >error from the DB. Everything functions except getting the error message

    >to
    >> >the user.
    >> >
    >> >I want to catch any and all errors at any point in time that happen in

    >the
    >> >application regardless of type. I don't mind doing try,catch,finally on

    >every
    >> >routine but I need to be guaranteed that I am capturing all the errors.
    >> >
    >> >Thanks for your response.
    >> >
    >> >"Scott Allen" wrote:
    >> >

    >>

    >
    Scott Allen, Sep 22, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWFydHkgVS4=?=

    Exception not being displayed

    =?Utf-8?B?TWFydHkgVS4=?=, Sep 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    372
    =?Utf-8?B?TWFydHkgVS4=?=
    Sep 21, 2004
  2. Replies:
    6
    Views:
    647
  3. mark | r
    Replies:
    1
    Views:
    305
    Edwin van der Vaart
    Oct 3, 2004
  4. tshad

    Session not being displayed

    tshad, Jun 26, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    319
    tshad
    Jun 27, 2006
  5. boney
    Replies:
    1
    Views:
    542
Loading...

Share This Page