Find jobs | Jobseekers
Employer login
About us Sitemap of www.CareerRide.com Sitemap FAQ related with www.CareerRide.com FAQ Click here to Contact us Contact
       
Submit Resume Free ! | Access Resume Free !
Home Career Services Resume Services Interview questions Articles Books
Content
ASP.NET Part 1
ASP.NET Part 2
ASP.NET Part 3
ASP.NET Part 4
ASP.NET Part 5
ASP.NET Advantages
ASP.NET Issues
ASP.NET Life cycle
ASP.NET Server control
ASP.NET Server vs. HTML
ASP.NET Datalist control
ASP.NET Application & session
ASP.NET Navigation method
ASP.NET Validation control
ASP.NET State Management
ASP.NET Caching
ASP.NET Exception Handling
ASP.NET Master pages
ASP.NET Tutorial
Session state management
Authentication-Authorization
Globalization-Localization
 
ADO.NET
NET Remoting
NET Interview
C#.NET
VB.NET
AJAX
 
PHP
 
C
C++
Java
Data Structure
Oops
 
Database concepts
SQL Server
Oracle
MySQL
Data warehousing
 
Operating System
Project Management
Linux
Testing
Networking
 
UML
XML
HTML
SOAP
CSS
VBScript
 
CV tips
Cover letter tips
Interview tips
Human resources
Soft skills

ASP.NET Exception Handling


By Nishant Kumar

ASP.NET exception handling technique - Interview questions

Define Exception handling in ASP.NET.
What are the ways of handling exceptions in ASP.NET?
Explain Try/catch block method of exception handling.
Define Error Events.
Define Custom Error Pages.
Why is exception handling important to an application?
When can you use tracing with exception handling?

Question - Define Exception handling in ASP.NET.

Answer -  Exceptions or errors are unusual occurrences that happen within the logic of an application. The CLR has provided structured way to deal with exceptions using Try/Catch block. ASP.NET also supports exception handling through server events such as Page_Error and Application_Error events.  

Question - What are the ways of handling exceptions in ASP.NET?

Answer - There are three ways to handle exceptions in ASP.NET
Try/catch/finally block.
Using Events like Page_Error and Application_Error
Using Custom error page

Question - Explain Try/catch block of exception handling.

Answer -   You can enclose code in Try/Catch/Finally block. You can catch all exceptions in the catch block. The third part of this block is finally. It is executed irrespective of the fact that an exception has been raised.

Question - Define Error Events.

Answer - ASP.NET supports events that occur when any unhandled exception occurs in an application. These events are called as Error Events.

ASP.NET provides two such events to handle exceptions

  • Page_Error : This is page event and is raised when any unhandled exception occur in the page.
  • Application_Error: This is application event and is raised for all unhandled exceptions in the ASP.NET application and is implemented in global.asax

The Error events have two methods to handle the exception: 

  • GetLastError: Returns the last exception that occurred on the server.
  • ClearError: This method clear error and thus stop the error to trigger subsequent error event.  .

Question - Define Custom Error Pages.

Answer - There are many errors that can’t be trapped in the application code like page not found. To intercept this kind of error, ASP.NET supports Custom Error Pages that can be specified at two places:

  • Specify application-wide error page settings in the customErrors section of the Web.config file.
  • Specify an error page for a specific Web form in the ErrorPage attribute of the Web form’s @ Page directive

Question - Why is exception handling important for an application?

Answer - .Exception handling is used to prevent application from being stuck due to unusual occurrences. If the exceptions are handled properly, the application will never get terminated abruptly. 

Question - When can you use tracing with exception handling?

Answer - You can use tracing with exception handling to log unanticipated exception to the trace log. The log file can be used to diagnose unanticipated problems and thus can be corrected.

.NET Code Security Interview questions with answers

What is code security? What are the types? | Define Principal object. | Define declarative and imperative security. | Define role-based security. | Explain code access security. | What is Code group? | Define the use of Caspol.exe.

.NET Debug & Trace Interview questions with answers 

What is break mode? What are the options to step through code? | Debug Vs Trace. | Define trace class. Define Listeners collection of Trace and Debug objects. | Define Trace Switches.

 

Today's Hot Jobs
C++  SQL Server
.NET  Java  Oracle
Finance  Marketing
Seekers  Employers
Copyright © 2008 CareerRide.com. All rights reserved.