Professional Web Applications Themes

catching exceptions from web user controls - ASP.NET General

You need to handle the Error event of the page. "noname" <abe.at.dont.include.this.virpack.com> wrote in message news:O3B2BYWRDHA.3132tk2msftngp13.phx.gbl... > 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 ...

  1. #1

    Default Re: catching exceptions from web user controls

    You need to handle the Error event of the page.

    "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    news:O3B2BYWRDHA.3132tk2msftngp13.phx.gbl...
    > 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 Guest

  2. #2

    Default Re: catching exceptions from web user controls

    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" <zlatkinamnospam.hotmail.com> wrote in message
    news:#lWLRZWRDHA.2148TK2MSFTNGP10.phx.gbl...
    > You need to handle the Error event of the page.
    >
    > "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    > news:O3B2BYWRDHA.3132tk2msftngp13.phx.gbl...
    > > 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 Guest

  3. #3

    Default Re: catching exceptions from web user controls

    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:%23iTeDgWRDHA.2676TK2MSFTNGP10.phx.gbl...
    > 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" <zlatkinamnospam.hotmail.com> wrote in message
    > news:#lWLRZWRDHA.2148TK2MSFTNGP10.phx.gbl...
    > > You need to handle the Error event of the page.
    > >
    > > "noname" <abe.at.dont.include.this.virpack.com> wrote in message
    > > news:O3B2BYWRDHA.3132tk2msftngp13.phx.gbl...
    > > > 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 Guest

Similar Threads

  1. Replies: 1
    Last Post: November 25th, 03:15 PM
  2. using javascript in User controls to access server controls of the user control
    By Faizan Ahmed in forum ASP.NET Building Controls
    Replies: 1
    Last Post: January 4th, 04:09 PM
  3. user controls: dynamiclly added child controls dont survive post back ?
    By Wolfgang Brucker in forum ASP.NET Building Controls
    Replies: 1
    Last Post: January 14th, 09:13 PM
  4. Catching thread exceptions
    By Steve Tuckner in forum Ruby
    Replies: 3
    Last Post: September 8th, 08:27 AM
  5. Catching events in web form fired by user control
    By Nick Lewis in forum ASP.NET General
    Replies: 1
    Last Post: August 1st, 12:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139