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

Differentiate between a page theme and a global theme?

718


how to write html code with ssl

1773


Explain the advantages of passport authentication.

695


What are the merits and demerits of viewstate?

783


Explain how asp.net page works?

767


How would ASP and ASP.NET applications run at the same time on the same server?

2191


how can create login from create and written conde in asp.net

1983


Which asp.net objects encapsulate the state of the client and the browser?

798


Which method do you use to enforce garbage collection in .net?

716


What is a global postback url?

709


Explain the difference between singleton and single call?

755


In which event of the page viewstate is available?

652


What are the event handlers that we can have in global.asax file?

728


What is slidemaster?

704


What is server side in asp.net?

713