ASP.NET - In which Event of Page Life Cycle Exceptions fire.
Asked By John Nash on 07-Feb-12 07:13 AM
Hi,
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
- Page Request
- Start
- Page Initialization
- Load
- Validation
- Postback event handling
- Rendering
- 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 :
http://msdn.microsoft.com/en-us/library/ms178472.aspx
http://wiki.asp.net/page.aspx/1512/aspnet-page-life-cycle-events/