ASP.NET supports events. When any unhandled exception occurs in an application, an event occurs, that events are called as Error Events.
ASP.NET is having two events to handle exceptions.
• Page_Error: This is page event and is raised when any unhandled exception occur in the page.
• Application_Error: This is application event and is raised for all unhandled exceptions in the ASP.NET application and is implemented in global.asax
The Error events have two methods to handle the exception:
• GetLastError: Returns the last exception that occurred on the server.
• ClearError: This method clear error and thus stop the error to trigger subsequent error event.
Asked In: Many Interviews |