ASP.NET - In which Event of Page Life Cycle Exceptions fire.

Asked By John Nash on 07-Feb-12 07:13 AM


Please let me know In which Event of Page Life Cycle Exceptions fire.
Venkat K replied to John Nash on 07-Feb-12 07:18 AM
Exceptions can occur in any of the page events... When there is an error in the statement the exception will be thrown.
Somesh Yadav replied to John Nash on 07-Feb-12 07:38 AM
Hi When a page request is sent to the Web server, the page is run through a series of events during its creation and disposal

so the exception may fires on any one of the events mentioned below

  1. Page Request
  2. Start
  3. Page Initialization
  4. Load
  5. Validation
  6. Postback event handling
  7. Rendering
  8. Unload
Danasegarane Arunachalam replied to John Nash on 07-Feb-12 07:39 AM
Handle the Page_Error method.

 Protected Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Error
      'Hanlde the Page_Error Event
    End Sub

This method will be fired whenever any unhanded exception is raised in your page.

You can handle this method to capture the unhandled exception  . This method helps to capture the exception on page level
Suchit shah replied to John Nash on 08-Feb-12 01:02 AM
Within each stage of the life cycle of a page, the page raises events that you can handle to run your own code and in any of the event error will aries .Pages also support automatic event wire-up, meaning that ASP.NET looks for methods with particular names and automatically runs those methods when certain events are raised

if you want to know more about page life cycle have a look here :