Answer Posted / alb.shah
"An exception handler is a piece of code which will be
called when an exception occurs."
.NET Framework provides several classes to work with
exceptions. The keywords try, catch are used to handle
exceptions in .NET. You have to put the code (that can
cause an exception) in a try block. If an exception occurs
at any line of code inside a try block, the control of
execution will be transfered to the code inside the catch
block.
If any statement within the try block raises an exception,
the control of execution will be transfered to the first
line within the catch block. You can write the error
handling code in the catch block, like recording the error
message into a log file, sending an email to the
administrator about the problem occurred, showing an
appropriate error message to the user etc.
You can optionally use a 'finally' block along with the try-
catch. The 'finally' block is guaranteed to be executed
even if there is an exception.
If an exception is not 'handled' in code, the application
will crash and user will see an ugly message. Instead, you
can catch the exception, log the errors and show a friendly
message to the user.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is difference between cache and session?
What is the function used for removing an event listener?
how to debug web services on consumer side?
Explain about asp.net 2.0 themes?
Describe how passport authentication works.
Why do we need a web application session?
What is the difference between asp.net and mvc?
when a request is made in Life cycle of ASP.NET page .
How can we prepairing Interview
How can i explain my project during interview?many time i expalain my project but they did't accept? please explain me.
How do you use viewstate?
Explain the different types of directives in .net?
How to count the number of objects present in a web page? How to count the number of radio buttons in a web page?
Write a code for passing ArrayList in Web API?
What is a reflection?