Wrox Programmer Forums
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 18th, 2004, 03:35 PM
Authorized User
Join Date: Jul 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error Handling in ASP.NET

In our asp.net code for the site, we handle the error raised in couple of different places as explained below.

1. Every function in the code behind file (.aspx.vb or .aspx.cs) I have a Try..Catch functionality.

2. In the Catch section of the Try..Catch, the HandleError function in errorhandler.vb class is called. This function gets parameter of Exception type.

3. HandleError function has code which redirects to error.aspx where the user friendly message is displayed and actual error is logged into the event log.

4. If the error is not trapped here, I have a code inside Application_Error function in global.asax.vb which does the same thing (redirect to error.aspx).

In both situations, I log the status of the response along with the actual error description (Response.Status). The problem here is: since the error logging is done inside the error.aspx page, I get the Reponse.Status inside that page as "200-OK" which means no error occured. Is there a way of getting the status of response object where the error occured.

Old August 18th, 2004, 06:18 PM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Do the error logging inside of Application_Error before you redirect. Then you will be in the page context of the page that is causing the error and you can get the error information.

Similar Threads
Thread Thread Starter Forum Replies Last Post
error handling in ASP kumiko Classic ASP Basics 2 November 14th, 2007 12:47 PM
Error Handling in asp.net 2.0 kulkarnimonica ASP.NET 2.0 Professional 1 June 29th, 2007 03:33 AM
Event handling in Asp.net durbalshah ASP.NET 1.0 and 1.1 Basics 1 April 13th, 2007 06:30 AM
error handling in asp.net e-commerce programming 123 All Other Wrox Books 0 October 19th, 2003 04:55 AM
Exception Handling in ASP.net class mittalpa VS.NET 2002/2003 0 July 11th, 2003 03:22 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.