0% found this document useful (0 votes)
61 views9 pages

Name:-Vrushabh Shashikant Rasal Class:Tybsc-It ROLL NO:556 Div: A Subject:-Advanced Web Programming

This document discusses exception handling in ASP.NET. It defines what an exception is and explains that exception handling is an in-built mechanism in .NET to handle runtime errors. It describes the different ways to handle exceptions in ASP.NET including using try-catch blocks, error events, and custom error pages. It also discusses unhandled exceptions and how ASP.NET provides a special case for custom error pages depending on the HTTP status code.

Uploaded by

Vrushabh Rasal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views9 pages

Name:-Vrushabh Shashikant Rasal Class:Tybsc-It ROLL NO:556 Div: A Subject:-Advanced Web Programming

This document discusses exception handling in ASP.NET. It defines what an exception is and explains that exception handling is an in-built mechanism in .NET to handle runtime errors. It describes the different ways to handle exceptions in ASP.NET including using try-catch blocks, error events, and custom error pages. It also discusses unhandled exceptions and how ASP.NET provides a special case for custom error pages depending on the HTTP status code.

Uploaded by

Vrushabh Rasal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

NAME:-VRUSHABH SHASHIKANT RASAL

T
CLASS:TYBSC-IT P.
N
E

S
ROLL NO:556 IN
A

DIV: A
G
I N
L
D
SUBJECT:-ADVANCED
H
A
N
WEB PROGRAMMING
N
IO
T
P
E
C
X
E
:
IC
P
O
T
EXCEPTION HANDLING IN ASP.NET
INTRODUCTION
Exception handling is an in-built mechanism in .NET Framework to detect and
handle run time errors. Exceptions are defined as anomalies that occur
during the execution of a program. The .NET Framework provides a rich
set of standard exceptions that are used during exceptions handling.
Exception handling is one of the major features provided by .NET. There
might be various reasons to handle exception, this can be caused due to
improper user inputs, improper design logic or system errors. In this
scenario, if applications do not provide a mechanism to handle these
anomalies, then there might be cases in which the application may crash.
.NET run time environment provides a default mechanism, which
terminates the program execution.
WHAT IS EXCEPTION HANDLING?
Exception handling refers to the way that a program handles exceptional
circumstances. ... Fortunately, most programming languages have a code
construct that will allow an exception to be handled smoothly. It requires
you to write an exception handler that will be called and run when an
exception is encountered.
ASP.NET EXCEPTION HANDLING

In ASP.NET, exception handling is achieved using


the Try - Catch - Finally block. All the three are ASP.NET keywords and are
used do exception handling. The try block encloses the statements that
might throw an exception whereas catch block handles any exception if one
exists. The finally block can be used for doing any clean up process. Any
general ASP.NET exception forces the application to terminate without
allowing the code to continue executing, resulting in an error page.
WAYS TO HANDLE EXCEPTION IN ASP.NET
1. Try-Catch block : This is also called Structured
Exception Handling(SEH)

2. Error Events: They are page level or


application level error events

3. Custom Error Page: This used for any

unhandled error
UNHANDLED EXCEPTIONS
 An unhandled exception is propagated to the caller of the function in which
it is raised.
 This propagation continues to the main function.
 If no handler is found, The default handler is called.
SPECIAL CASE
This option provides a special case for the custom error page depending upon the
HTTP status code. For example, a custom error page if the request attempts to
access a page does not exist (HTTP 404). Following configuration element need to
be put that can be nested in <customErrors>, <error> as:
THANK YOU!

You might also like