Page 123 - DCAP312_WEB_TECHNOLOGIES_II
P. 123
Unit 6: Error Handling
Error event. This method would be triggered previous to the corresponding application handler Notes
would be invoked. Such an implementation would be beneficial if you have multiple projects
with the same global error handling implementation. In such a scenario, you could create a
module and attach it to each web application you have.
In 1996 the Ariane V rocket exploded due in part to the Ada programming
language exception handling policy of aborting computation on arithmetic
error - a floating point to integer conversion overflow - which would not have
occurred if IEEE 754 exception-handling policy had been used.
Self Assessment Questions
Multiple Choice Questions
True or False
1. The Visual Basic language provides many keywords.
( a) True (b) False
2. ASP.NET would not automatically add one with the name aspx error path.
( a) True (b) False
3. ASP.Net uses its default error page for both local and remote users in ........................
( a) Page level (b) Execute
( c) case of an error (d) Debugging
4. ............................... execution at page level or application level.
( a) Transfer Protocol (b) Application level
( c) error (d) Tracing the program
5. Trace object allows you to add custom information to the ...........................
( a) trace output. (b) Compile error
( c) Runtime (d) Logic error
6.4 Web Application Error Handling in ASP.NET
All applications have to error handling. This we all know. We cannot always be notified of an
unhandled error (and usually are not) when one occurs on a client’s machine. The benefit we
have on the Web is that we can always be notified when an unhandled error occurs. With the
advent of ASP.NET, there are various enormous new ways to handle errors. There are some
differences in .NET in not only how to handle the error, but how the information is provided to
you. For example, classic ASP uses Server.GetLastError to return an ASPError object. You can
and should still use Server.GetLastError in .NET, but this now returns a type System.Exception.
6.4.1 The Problem
Errors will occur in our applications. We try to trap for most errors using try-catch blocks;
however, we usually do not cover every possible exception. What happens when an unhandled
error occurs? Usually the user is brought to IIS’s default error pages (usually located in c:\
winnt\help\iishelp\common). The downsides are you have no idea when this occurs and the
page does not have your site’s look and feel.
Errors are a development fact, but we strive to eliminate or handle them gracefully. With this
in mind, we need to know:
LOVELY PROFESSIONAL UNIVERSITY 117