|
ASP.NET exception handling technique - Interview questions |
Views: 2364
|
Thread Tools | Rate Thread |
#1
|
|||
|
|||
ASP.NET exception handling technique - Interview questions
ASP.NET exception handling technique - Interview questions
Question - Define Exception handling in ASP.NET. Answer - Exceptions or errors are unusual occurrences that happen within the logic of an application. The CLR has provided structured way to deal with exceptions using Try/Catch block. ASP.NET also supports exception handling through server events such as Page_Error and Application_Error events. Question - What are the ways of handling exceptions in ASP.NET? Answer - There are three ways to handle exceptions in ASP.NET Try/catch/finally block. Using Events like Page_Error and Application_Error Using Custom error page Question - Explain Try/catch block of exception handling. Answer - You can enclose code in Try/Catch/Finally block. You can catch all exceptions in the catch block. The third part of this block is finally. It is executed irrespective of the fact that an exception has been raised. Question - Define Error Events. Answer - ASP.NET supports events that occur when any unhandled exception occurs in an application. These events are called as Error Events. ASP.NET provides two such events to handle exceptions
Answer - There are many errors that can’t be trapped in the application code like page not found. To intercept this kind of error, ASP.NET supports Custom Error Pages that can be specified at two places:
Answer - .Exception handling is used to prevent application from being stuck due to unusual occurrences. If the exceptions are handled properly, the application will never get terminated abruptly. Question - When can you use tracing with exception handling? Answer - You can use tracing with exception handling to log unanticipated exception to the trace log. The log file can be used to diagnose unanticipated problems and thus can be corrected. |