473,796 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exception Handling Scope

Can exceptions only be handled in a protected block?

For example, can I globally catch and handle any exception generated from an
ASP.NET page without placing the entire Page_Load event handler code in a
try-catch block?

--
Regards,

Fred Chateau
fchateauAtComca stDotNet
Nov 11 '06 #1
1 1544
Hi Fred,

Placing the entire Page_Load event handler in code wouldn't catch all
exceptions that may be thrown by the page. There are many other events that
are raised during the ASP.NET page life cycle and Load is only one of them.

"ASP.NET Life Cycles"
http://msdn2.microsoft.com/en-us/library/ms227435.aspx

Error handling can be configured in the web.config, on the Page level or
handled explicitly in code using either the global.asax file or custom
HttpModules.

Of course, you are encouraged to use judicious error handling on the method
level as well. But don't just catch everything - only catch what you can
handle gracefully.

"Error Handling in ASP.NET Pages and Applications"
http://msdn2.microsoft.com/en-us/library/w16865z6.aspx

--
Dave Sexton

"Fred Chateau" <fc******@127.0 .0.1wrote in message
news:uX******** ******@TK2MSFTN GP04.phx.gbl...
Can exceptions only be handled in a protected block?

For example, can I globally catch and handle any exception generated from an
ASP.NET page without placing the entire Page_Load event handler code in a
try-catch block?

--
Regards,

Fred Chateau
fchateauAtComca stDotNet

Nov 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
2263
by: Frank Puck | last post by:
Meanwhile there are at least 8 years that compilers exist, which provide a working implementation of C++ Exception Handling. Has anything changed meanwhile? From my point of view nothing has changed -- people are still using a coding style, which I call pre-C++-Exception-Handling. Is this different in your experience? What is your experience regarding this subject? I think that a C++ IOstream lib, which is by standard free of exceptions...
9
1329
by: chenchang | last post by:
Hi, experts. i write a simple program to test EH in G++: void throwfunction() { throw "test"; } class A { int i;
3
1357
by: John Ruiz | last post by:
Hello. I was wondering about exceptions and how to throw them within functions/methods and catch them. Suppose that we've got: ---------------------------------------------------------------- void MyFunc() { //... if (somethingBad) throw MyException("Throwing exception"); //...
4
2036
by: Robbie Hatley | last post by:
I've been playing with "auto_ptr" and the "Resource Acquisition Is Initialization" concept. On page 199 of Lippman's book "Effective C++" he says "All active local class objects of a function are guaranteed to have their destructors applied before termination of the function by the exception handling mechanism.". I don't think that's true, though. The standard doesn't seem to require it. Section 15.2 just says that all objects...
5
2571
by: juergen perlinger | last post by:
Hello out there. sometimes I need to have proper control of the floating point arithmetic of the C(and C++) runtime system, and using the f.p. exception handling of the C99 standard is quite handy for that purpose. The only problem when dealing with f.p. exception signals is that there is (afaik) no specification *when* the f.p. exception is raised, with one notable exception: 'feraiseexcept(int)' raises the exceptions passed in the...
1
2177
by: Dan Weatherman | last post by:
Hi all, Using WMI I am attempting to catch and exception when doing a managementscope.connect operation. From the looks of things, this method starts a new worker thread through Interop that then executes the method. My problem is that regardless of what all I use in my catch statements, the system still raises the initial dialog reporting the exception. Eventually, my app catches and handles the exception but I cannot get the initial...
1
2342
by: Paramveer.Singh | last post by:
Hi! I am a developer working for a company which typically deploys apps on Oracle. We would like to move to postgres for obvious reasons. However, most of  our legacy apps use the exception handling support provided by PL/SQL. Instead of porting each of these procedures by hand, we would like to add exception handling support to pgSQL if possible.
132
5626
by: Zorro | last post by:
The simplicity of stack unraveling of C++ is not without defective consequences. The following article points to C++ examples showing the defects. An engineer aware of defects can avoid hard-to-find bugs. http://distributed-software.blogspot.com/2007/01/c-exception-handling-is-defective.html Regards, zorabi@ZHMicro.com http://www.zhmicro.com http://distributed-software.blogspot.com
6
3394
by: Mohan | last post by:
Hi, I am learning the Exception Handling in C++. I wrote a small program using Exception Handling. I am using Vistual Studio 6. It is working fine in Win32 Debug build, but it is not catching the exception in Win32Release mode.
5
1935
by: NeBlackCat (lists) | last post by:
Hello everybody - my first post! And it may be the most monumentally stupid question ever asked, but I just can't see an answer after several hours experimenting, searching and reading. It's simply this - how can a function determine whether or not it's being called in handling of an exception (ie. there is an "active" exception, and somewhere upstream on the stack there is an except: block statement)? Depending on what you read,...
0
9531
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10018
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6795
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.