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

Explain automatic memory management in .net.

793


Why asp.net is used?

768


What is the life cycle of an asp.net page?

712


what is AutoEventWireUp and what is the use of This property explain in details?

1370


Is there any alternative to avoid name collisions other then Namespaces?

857


Explain the Session state management options available with ASP.NET?

793


What is the parent class of all web server control?

770


Is asp.net web forms dead?

750


Asp pages that worked pefectly on windows 2000 server and iis 5.0 do not work on windows 2003 server with iis 6.0. Asp.net pages work fine. Why?

782


Name the two properties are on every validation control?

759


How do cookies work? Give an example of their abuse.

763


What does ascx stand for?

719


Is there any limit for query string? Means what is the maximum size?

731


Types of instancing properties and explain each. Tell the difference between multiuse,singleuse and globalmultiuse and which is default ?

2529


What is .net remoting?

837