Re: catching exceptions from web user controls

Discussion in 'ASP .Net' started by Marina, Jul 8, 2003.

  1. Marina

    Marina Guest

    You need to handle the Error event of the page.

    "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    news:...
    > i want to be able to throw an exception in my web user control and catch

    it
    > in the containing page. i've tried overloading some of the page methods

    to
    > no avail. here's the stack trace:
    >
    > .
    > .
    > .
    > ANameSpace.FooClass.Page_Load(Object sender, EventArgs e) in

    foo.ascx.cs:64
    > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > System.Web.UI.Control.LoadRecursive() +29
    > System.Web.UI.Control.LoadRecursive() +92
    > System.Web.UI.Control.LoadRecursive() +92
    > System.Web.UI.Page.ProcessRequestMain() +724
    >
    > as far as i can tell, the only place i could inject some try-catch code

    into
    > the page is at Page.ProcessRequestMain() ... but i can't seem to override
    > ProcessRequestMain.
    >
    > any help?
    >
    > thanks a ton.
    >
    >
     
    Marina, Jul 8, 2003
    #1
    1. Advertising

  2. Marina

    noname Guest

    thanks for your help. would you mind posting an example? i tried doing
    this once but couldn't get it to compile.

    thanks again!

    "Marina" <> wrote in message
    news:#...
    > You need to handle the Error event of the page.
    >
    > "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    > news:...
    > > i want to be able to throw an exception in my web user control and catch

    > it
    > > in the containing page. i've tried overloading some of the page methods

    > to
    > > no avail. here's the stack trace:
    > >
    > > .
    > > .
    > > .
    > > ANameSpace.FooClass.Page_Load(Object sender, EventArgs e) in

    > foo.ascx.cs:64
    > > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > > System.Web.UI.Control.LoadRecursive() +29
    > > System.Web.UI.Control.LoadRecursive() +92
    > > System.Web.UI.Control.LoadRecursive() +92
    > > System.Web.UI.Page.ProcessRequestMain() +724
    > >
    > > as far as i can tell, the only place i could inject some try-catch code

    > into
    > > the page is at Page.ProcessRequestMain() ... but i can't seem to

    override
    > > ProcessRequestMain.
    > >
    > > any help?
    > >
    > > thanks a ton.
    > >
    > >

    >
    >
     
    noname, Jul 8, 2003
    #2
    1. Advertising

  3. Marina

    Marina Guest

    It's the same way you handle the load event. Just look at what is generated,
    and change it to be for the Error event. Also, there are many examples of
    this on the web.

    "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    news:%...
    > thanks for your help. would you mind posting an example? i tried doing
    > this once but couldn't get it to compile.
    >
    > thanks again!
    >
    > "Marina" <> wrote in message
    > news:#...
    > > You need to handle the Error event of the page.
    > >
    > > "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    > > news:...
    > > > i want to be able to throw an exception in my web user control and

    catch
    > > it
    > > > in the containing page. i've tried overloading some of the page

    methods
    > > to
    > > > no avail. here's the stack trace:
    > > >
    > > > .
    > > > .
    > > > .
    > > > ANameSpace.FooClass.Page_Load(Object sender, EventArgs e) in

    > > foo.ascx.cs:64
    > > > System.Web.UI.Control.OnLoad(EventArgs e) +67
    > > > System.Web.UI.Control.LoadRecursive() +29
    > > > System.Web.UI.Control.LoadRecursive() +92
    > > > System.Web.UI.Control.LoadRecursive() +92
    > > > System.Web.UI.Page.ProcessRequestMain() +724
    > > >
    > > > as far as i can tell, the only place i could inject some try-catch

    code
    > > into
    > > > the page is at Page.ProcessRequestMain() ... but i can't seem to

    > override
    > > > ProcessRequestMain.
    > > >
    > > > any help?
    > > >
    > > > thanks a ton.
    > > >
    > > >

    > >
    > >

    >
    >
     
    Marina, Jul 8, 2003
    #3
    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. Amil Hanish
    Replies:
    0
    Views:
    571
    Amil Hanish
    Apr 13, 2006
  2. Adam Maass
    Replies:
    5
    Views:
    434
    Sudsy
    Jul 22, 2003
  3. Mike Schilling
    Replies:
    2
    Views:
    364
    Mike Schilling
    Jul 16, 2003
  4. Mick
    Replies:
    0
    Views:
    463
  5. Daniel Bress
    Replies:
    0
    Views:
    351
    Daniel Bress
    Sep 8, 2003
Loading...

Share This Page