How can u handle Exceptions in Asp.Net?

Answers were Sorted based on User's Feedback



How can u handle Exceptions in Asp.Net?..

Answer / aadil

In ASP.NET, we have three types of Error Handling.
1. Structured Level Error Handling (try..catch..finally
block)
2. Page Level Error Handline
3. Application Level Error Handling.

Is This Answer Correct ?    3 Yes 0 No

How can u handle Exceptions in Asp.Net?..

Answer / 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

How can u handle Exceptions in Asp.Net?..

Answer / guest

using system.exceptions namespace

Try
Piece of code ..
Catch objError as Exceptions
display objError.message
Finally

Is This Answer Correct ?    0 Yes 0 No

How can u handle Exceptions in Asp.Net?..

Answer / senthil kumar

try
{
//set of code
}
catch(Exception1 e)
{
//error display
}
catch(Exception2 e)
{
//error display
}
finally
{
//compulsory execution will be done here
}

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

what is roles in asp.net

2 Answers  


What is page request in asp.net?

0 Answers  


What is the use of placeholder control? Can we see it at runtime?

0 Answers  


What is the difference between ldap and active directory?

0 Answers  


repeater and gridview diff? Why is repeater fast than gridview?

3 Answers   TCS,


how can we display records in single datagrid using two datasets in different place?

2 Answers   Global Computer, Honeywell,


What is Web Services?How we can consume a Web Services in our application?Explain.

1 Answers   Religare,


# What is the transport protocol you use to call a Web service?

1 Answers  


Can the action attribute of a server-side tag be set to a value and if not how can you possibly pass data from a form page to a subsequent page?

1 Answers  


I have created a configuration setting in my web.config and have kept it at the root level. How do I prevent it from being overridden by another web.config that appears lower in the hierarchy?

0 Answers  


What is the difference between exe and dll?

0 Answers  


What is the mvc model?

0 Answers  


Categories