473,883 Members | 2,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

catching all errors

hey all,
is there a way to catch all errors for my webform without using the
global.asax page?
thanks,
rodchar
Nov 19 '06 #1
6 1076
"rodchar" <ro*****@discus sions.microsoft .comwrote in message
news:D0******** *************** ***********@mic rosoft.com...
is there a way to catch all errors for my webform without using the
global.asax page?
Other than surrounding all your code with try...catch, I don't think so...
Nov 19 '06 #2
Hello Mark,

BTW, u can handle your exceptions with System.Web.UI.P age.Error even

MR"rodchar" <ro*****@discus sions.microsoft .comwrote in message
MRnews:D0****** *************** *************@m icrosoft.com...
MR>
>is there a way to catch all errors for my webform without using the
global.asax page?
MROther than surrounding all your code with try...catch, I don't think
MRso...
MR>
---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Nov 19 '06 #3
Hi Michael,
Can you please explain what mean?
many thanks
"Michael Nemtsev" <ne*****@msn.co mwrote in message
news:17******** *************** ****@msnews.mic rosoft.com...
Hello Mark,

BTW, u can handle your exceptions with System.Web.UI.P age.Error even

MR"rodchar" <ro*****@discus sions.microsoft .comwrote in message
MRnews:D0****** *************** *************@m icrosoft.com...
MR>
>>is there a way to catch all errors for my webform without using the
global.asax page?
MROther than surrounding all your code with try...catch, I don't think
MRso...
MR---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche


Nov 20 '06 #4
"Annie" <my************ **@gmail.comwro te in message
news:45******@d news.tpgi.com.a u...
Can you please explain what mean?
http://msdn2.microsoft.com/en-us/lib...40(VS.80).aspx

Pay particular attention to the very first line of the article, which says:
"If possible, you should handle errors in Try/Catch blocks within your
code..."

That is the preferred method of error handling in .NET applications, but
Michael is correctly reminding me that it's not the *ONLY* way...

AAMOI, is anyone actually using Page_Error...?
Nov 20 '06 #5
That website is TOTALLY AND ABSOLUTELY WRONG. It _WILL_ get corrected during
the next major revision (or help me god...). Well over 90% of the time you
can't handle an actual exception..all you can do is clean up...in which case
you should be using try/finallys and "usings". Your logging code should be
centralized, and the best way to do this is with Global.asax's on error ..

Handling exceptions in global.asax is the CORRECT way to do things.

As was mentioned, you can also catch errors in the page. you can do this by
overriding the OnError method.

protected override void OnError(EventAr gs e)
{
...
}

if you put this in a base class and have all your pages inherit from it,
you're good to go.

More on exception hanlding in .NET:
http://codebetter.com/blogs/karlsegu...05/142355.aspx

Karl
--
http://www.openmymind.net/
http://www.codebetter.com/
"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:eP******** ******@TK2MSFTN GP04.phx.gbl...
"Annie" <my************ **@gmail.comwro te in message
news:45******@d news.tpgi.com.a u...
>Can you please explain what mean?

http://msdn2.microsoft.com/en-us/lib...40(VS.80).aspx

Pay particular attention to the very first line of the article, which
says: "If possible, you should handle errors in Try/Catch blocks within
your code..."

That is the preferred method of error handling in .NET applications, but
Michael is correctly reminding me that it's not the *ONLY* way...

AAMOI, is anyone actually using Page_Error...?
Nov 20 '06 #6
"Karl Seguin" <ka********@rem oveopenmymindre movemetoo.andme netwrote in
message news:OD******** ******@TK2MSFTN GP02.phx.gbl...
That website is TOTALLY AND ABSOLUTELY WRONG. It _WILL_ get corrected
during the next major revision (or help me god...).
Glad to hear it!

For the record, I wasn't actually recommending following its contents -
quite the reverse... :-)
Well over 90% of the time you can't handle an actual exception..all you
can do is clean up...
in which case you should be using try/finallys and "usings".
I couldn't agree more...
>Your logging code should be centralized, and the best way to do this is
with Global.asax's on error ..
Again, totally agreed...
Nov 20 '06 #7

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

Similar topics

7
2343
by: cmay | last post by:
FxCop complains every time I catch System.Exception. I don't see the value in trying to catch every possible exception type (or even figuring out what exceptions can be caught) by a given block of code, when System.Exception seems to get the job done for me. My application is an ASP.Net intranet site. When I catch an exception, I log the stack trace and deal with it, normally by displaying an error
0
1079
by: R. MacDonald | last post by:
Hi, I have a VB.Net application that dynamically calls unmanaged routines in a DLL that has been created by Fortran (DVF v5). The call to the DLL routine is within a Try/Catch block, but when one of the DLL (Fortran) routines triggers a run-time error, the VB.Net application terminates rather than catching the error. Is there any way to be able to catch these Fortran run-time errors in
4
1970
by: John Pye | last post by:
Hi all I have some C code that is giving me some 'nan' values in some calculations. The C code is wrapped using SWIG to give me a Python module that I am then exercising through a unittest suite. It seems that I should expect the C code to throw floating point exceptions (SIGFPE) and either the whole thing to abort, or for Python to catch the errors and report them. Instead I'm getting neither. I want to be able to track down the...
25
2382
by: JJ | last post by:
I only want to catch 404 errors at the application level (the rest are will be handled by the customerrors section of the web.config). How do I check for the error code in the Application_Error of Global.asax ? Thanks, JJ
3
3294
by: john | last post by:
I wrapped some fortran code using F2PY and need to be able to catch fortran runtime errors to run the following: # "grid" is a wrapped fortran module # no runtime errors incurred when run with the correct inputs for filetype #------------------------------- def readGrid( self, coord='xyz' ): mg = ( '.FALSE.', '.TRUE.' ) form = ( 'FORMATTED', 'UNFORMATTED' )
0
9799
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
11166
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...
1
10868
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9588
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
5808
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
6009
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4231
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3242
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.