How can u handle Exceptions in Asp.Net?

Answer Posted / poornima p

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.

<Script runat=server>
Public Page_Load(sender As Object, e As EventArgs)
{
try
{
// Statements that are can cause exception
}
catch(Type x)
{
// Statements to handle exception
}
finally
{
// Statement to clean up
}
}
</Script>
Custorm Errors:
The default settings that is available in machine.config is
as follows
<customErrors mode="RemoteOnly"/>

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the security types in asp.net?

572


How does session work?

504


What are the different types of cookies in asp.net?

517


What is the difference between Hash table and Array list?

369


Is razor a programming language?

525






Is asp.net different from asp? If yes, explain how?

488


Differentiate between a hyperlink control and a linkbutton control.

550


Do I need to have the latest version of windows media player installed?

509


What is meant by web application?

537


What are the file extensions for razor views?

668


How can we make sure that Web API returns JSON data only?

531


What is AutoEventWireup attribute for ?

595


Is it possible to apply themes to an asp.net application? If yes, then how?

566


How many types of triggers are there in update panel?

567


Explain form level validation and field level validation?

509