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. Advertisements

  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. Advertisements

  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. Advertisements

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. Axel Dahmen
    Replies:
    1
    Views:
    817
    Teemu Keiski
    Nov 12, 2003
  2. Amil Hanish
    Replies:
    0
    Views:
    686
    Amil Hanish
    Apr 13, 2006
  3. Adam Maass
    Replies:
    5
    Views:
    645
    Sudsy
    Jul 22, 2003
  4. Mike Schilling
    Replies:
    2
    Views:
    447
    Mike Schilling
    Jul 16, 2003
  5. Nathan Sokalski
    Replies:
    5
    Views:
    1,294
    Gaurav Vaish \(www.Edujini-Labs.com\)
    Jan 10, 2007
  6. mpnordland
    Replies:
    24
    Views:
    1,182
  7. Nathan Sokalski
    Replies:
    4
    Views:
    536
    Nathan Sokalski
    Dec 21, 2006
  8. Nathan Sokalski
    Replies:
    4
    Views:
    580
    Nathan Sokalski
    Dec 21, 2006
Loading...