473,421 Members | 1,434 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

Best strategy for all errors?

Many of our apps are in production and they do not have proper error logging
in them - unhandled errors are seen by the users in the form of error
messages and stack traces. I know how to make apps handle their errors
(global.asax.cs "application_error" event, web.config "customErrors"
section, etc). But can I do this without having to visit each app? Can
this be done at the machine level? I'm looking for a kind of machine-level
"application error" event that will handle any untrapped errors. How is
this done? Thanks! --Marty
Nov 18 '05 #1
2 1604
Hi Marty,
Thanks for posting in the community!
From your description, you'd like to provide a more friendly error
displaying view(a custom error screen) for the client user rather then the
system's exception detailed info page when unhandled exceptions occurs in
ASP.NET web applicatoin. Also, you want to find some place to configure it
at machine level rather than configure it everytime in a certain web
application, yes?
If there is anything I misunderstood, please feel free to let me know.

Based on my experience, you can try using the <customErrors > element in
the ASP.NET 's web application configuration schema. There is a "mode"
attribute in the <customErrors> element, we can set it to control whether
to show the detailed error info page or redirect user to the custom error
page (set via the "defaultRedirect" attribute). For example:

<customErrors defaultRedirect="mycustomererrorpage.htm" mode="On">
</customErrors>

The above setting told the ASP.NET runtime when unhandled error occurs,
don't show the detailed exception info page( because we set the "mode=On"),
and redirect the user to the custom error page(we set in the
"defaultRedirect" attribute).
Here is the detailed description of the "mode" attribute in MSDN:

On-------------------- Specifies that custom errors are enabled. If no
defaultRedirect is specified, users see a generic error.

Off -------------------Specifies that custom errors are disabled. This
allows display of detailed errors.

RemoteOnly -------------------Specifies that custom errors are shown only
to remote clients and ASP.NET errors are shown to the local host. This is
the default.

For detailed info of the <customErrors> configure tag, you can view the
following tech reference in MSDN:
#<customErrors> Element
http://msdn.microsoft.com/library/en...tomerrorsSecti
on.asp?frame=true

This error handling setting can be configured in both web.config file(web
application level) and machine.config(machine level). Since you want to set
it for all web apps on a certain machine, you can find the <customErrors>
tag in the machine.config file and set it. For example, if you want to
prevent client user from seeing the detailed exception info page. You can
set the <customErrors> tag in machine.config as below:
<customErrors defaultRedirect="customErrorPage.html" mode="RemoteOnly">
</customErrors>

Then, you also need to have a "customErrorPage.html in each web
application. After that, each time unhandled exception occurs in a web
application, the remote user will see the customErrorPage.html rather than
the detailed exception info page. But the localuser can still see the
detailed error info page. How do you think of this?

In addition, here is some other tech aritcles on ASP.NET configuration and
providing custom error report page:

#INFO: ASP.NET Configuration Overview
http://support.microsoft.com/?id=307626

#HOW TO: Create Custom Error Reporting Pages in ASP.NET by Using Visual C#
.NET
http://support.microsoft.com/?id=306355

#Rich Custom Error Handling with ASP.NET
http://msdn.microsoft.com/library/en...rs.asp?frame=t
rue

I believe they're also helpful to you. Please check out the above
suggestions. If you feel anything unclear, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #2
Hi Marty,
Have you had a chance to try out my suggestions or have you got any ideas
on this issue? If you need any assistance, please feel free to post here.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #3

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

Similar topics

1
by: Binoy | last post by:
Hello, I am new to .NET, so if my questions is dumb, please excuse me. We are moving our ASP model site to ASP.NET and I would like to know the best deployment strategy that we can use (we...
4
by: Claudio Jolowicz | last post by:
I am trying to find a solution to the following design problem (code at the bottom): We are implementing a trader agent that can trade with other traders on an electronical trading platform. To...
10
by: Neil | last post by:
I need to get two values from a complex SQL statement which returns a single record and use those two values to update a single record in a table. In order to assign those two values to variables...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
1
by: ALI-R | last post by:
I'm recieving some CSV files from our clients and they are supposed to be written in the Database.Considering the following issues: 1) The CSV files should be hughly validated,each field against...
0
by: Lucas Tam | last post by:
Hi all, I have an application which needs to manage the status on a server with 96 phone line ports. Each port is an indepedent process and reports status codes independently. Currently I...
0
by: cyprian.pl | last post by:
Hello, I would like to ask some opinions on the best DB strategy for the following problem: I have a table containing information about artists (names, dates, descriptions in three languages...
2
by: Petr Jakes | last post by:
I am a little bit confused by all possibilities for exceptions handling in Python (probably because I am not skilled enough??) I did try to search trough this list and reading Python tutorial about...
4
by: Paciente8159 AKA Klayman | last post by:
Hi, I have a couple of doubts reggarding a plugin based application in C++? I want to build a c++ plugin based app. I have searched alot of things in the net but I still don't know how to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
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,...

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.