473,660 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET Looping in Application_Err or handler

Hi,

I have an ASP.NET application that catches un-handled exceptions in the Application_Err or method and writes the details to the Event Log. But, if I do a Server.ClearErr or() followed by either a Server.Transfer or Response.Redire ct to another ASP.NET page, then it causes .NET to re-enter the Application_Err or function.

I thought that maybe there is an exception being thrown in the Application_Err or function, but after placing a try/catch block around it I found that there was not.

So, I removed the Server.ClearErr or and added a defaultRedirect to my web.config file instead. This stopped the above effects from happening, but it complained about the settings:

mode="On" defaultRedirect ="unhandledexce ption.aspx"

After trying various paths to the page I changed it to redirect to a HTML file. And it worked!!! So, I then changed it to an ASP page with a Response.Redire ct to the ASP.NET page and I got the page I wanted.

These events have raised a few questions I am hoping someone could answer:

1) Why did a call to Server.Transfer and Response.Redire ct in the Application_Err or function cause ASP.NET to continue re-entering Application_Err or?

2) Why did ASP.NET not like my customErrors element in the web.config when I had a defaultRedirect to a ASP.NET page?

3) Should I keep an eye for any side-effects of going out to a ASP page and then back into an ASP.NET page in respect to the way I handle errors using the web.config?

Any thoughts on these issues would be appreciated because they have been driving me NUTS and I can't work out why it is happening.

Many Thanks

Michael
Nov 18 '05 #1
0 1072

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

Similar topics

1
3781
by: John Scott | last post by:
Hi there, I have an odd situation. I have exception handling set up in my Application_Error event handler in my global.asax. On my development box, errors get caught by the event handler fine and redirect the user to an error page manually...I know about the defaultRedirect but I'm just not using it. Now when I try to recreate an error on my production box, I get the standard asp.net error page with the big yellow bar accross the top...
3
3031
by: tafs7 | last post by:
My code below is supposed to email me when an error occurs on the application, but it's not emailing anything. Am I missing something? I know the smtp servers I've tried work. I even added a App_Start handler to see if I could get emailed at all even from the first request of the app, but to no avail. Could someone please help me out? Thanks a lot! --Thiago Web developer AgniTEK
3
3210
by: Mike Malter | last post by:
I have a general error page that I configured in web.config as <customErrors mode="On" defaultRedirect="CRDefaultError.aspx" /> This error page comes up whenever an error occurs outside of any try/catch blocks. This page has a text box in it that I would like to fill with relevant information about the error. I am trying to put the Server.GetLastError().ToString() in there. It did not work on the page, and I read somewhere that I should...
2
3010
by: A.M | last post by:
Hi, I have the following code in Global.asax. Using a breakpoint, i can see that that all errors are being trapped in Application_Error and the event handler is being run properly. The problem is still it shows standard ASP.NET error screen. That means Response.Redirect ("genericerror.htm "); is being ignored. How can i fix this problem ? Thanks, Allan
0
968
by: Michael | last post by:
Hi, I have an ASP.NET application that catches un-handled exceptions in the Application_Error method and writes the details to the Event Log. But, if I do a Server.ClearError() followed by either a Server.Transfer or Response.Redirect to another ASP.NET page, then it causes .NET to re-enter the Application_Error function. I thought that maybe there is an exception being thrown in the Application_Error function, but after placing a...
2
2112
by: Carl Johansen | last post by:
I've been reading the O'Reilly "ASP.NET Cookbook" 1st edition (Kittel and LeBlond), and it makes a recommendation about exception handling that seems a bit strange. They say that, if you want to let some exceptions propagate up to Application_Error, you should include the following Page_Error on every page: Private Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Error Throw Server.GetLastError() End...
6
1428
by: Rippo | last post by:
I have a problem with the application_error event being fired from my asp.net application with windows 2003 server standard edition. The event fires fine from my test machine (XP) and all works well. However the event never appears to fire from windows 2003. I have tried just about everything and can not find an answer. I cannot debug through the windows 2003 server as I do not have VS installed on it plus it is a live server Can any...
1
1850
by: David Herbst | last post by:
VS 2005 / .NET 2.0 Windows 2000 Server sp4 (on development as well as testing server) Using Web Deployment Project to build assemblies for testing and production servers. I added a Global.asax file to my web site so I could implement a Application_Error() handler. The handler works fine on my development web server but when I deploy it to the testing web server it doesn't execute. Instead I get the detailed ASP.NET error page or my...
10
2356
by: Nemisis | last post by:
Hi everyone, I am trying to create a custom error page, that the user gets shown when a error has occurred within my website. The code works perfectly, apart from when an invalid URL is typed in, then i am unable to pass the exception from the global.asax file to the page via the sessionstate. Everytime i try to pass something into the sessionstate i get a error message of 'Object reference not set to an instance of an object.'
0
8341
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
8851
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
8630
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
7362
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...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
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();...
1
2760
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
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
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.