Error Events method of exception handling - ASP.NET

Explain Try/catch block of exception handling.

- You can enclose the 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.

try:

- It identifies a block of code for which particular exceptions are activated.
- It is followed by one or more catch blocks.
- It can be a compound statement.

catch:

- It catches an exception with an exception handler at the place in a program where you want to handle the problem.
- It indicates the catching of an exception.
- There are multiple Catch blocks permitted.

Syntax:
try
{
   //Statements
}
catch(ExceptionName e1)
{
   //Error handling code
}
catch(ExceptionName e2)
{
   //Error handling code
}
catch(ExceptionName eN)
{
   //Error handling code
}
- It provides a way to handle some or all possible errors that may occur in a given block of code while still running code.
Custom Error Pages method of exception handling - ASP.NET
ASP.NET - Custom Error Pages method of exception handling - ASP.NET supports events that occur when any unhandled exception occurs in an application. These events are called as Error Events...
Why is exception handling important to an application?
ASP.NET - Why is exception handling important to an application? - Exception handling is used to prevent application from being stuck due to unusual occurrences...
When can you use tracing with exception handling?
ASP.NET - When can you use tracing with exception handling? - You can use tracing with exception handling to log unanticipated exception to the trace log......
Post your comment