473,809 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ignore exception in Application_Err or event but maintain state

Hi,
I would like to ignore a certain exceptions in
Application_Err or event in Global.asax.cs file and still
have the page's state be maintained. If I simply issue:

Server.ClearErr or()

I end up with a blank page. If I issue:

Server.ClearErr or();
Response.Redire ct(Request.UrlR eferrer.ToStrin g());

I end up with the page that I want to be displayed but
it's state (TextBox's have been cleared) is lost.

Thanks for your help,
Terry
Nov 17 '05 #1
2 5554
what you need to do is catch the error before it bubbles up to the
application level then you won't have all these problems.

"twahl" <te********@msn .com> wrote in message
news:00******** *************** *****@phx.gbl.. .
Hi,
I would like to ignore a certain exceptions in
Application_Err or event in Global.asax.cs file and still
have the page's state be maintained. If I simply issue:

Server.ClearErr or()

I end up with a blank page. If I issue:

Server.ClearErr or();
Response.Redire ct(Request.UrlR eferrer.ToStrin g());

I end up with the page that I want to be displayed but
it's state (TextBox's have been cleared) is lost.

Thanks for your help,
Terry

Nov 17 '05 #2
Hi Terry,

Based on my experience, we are not able to keep page's state after calling
Server.ClearErr or(). To work around this problem, I suggest you to use
structured exception (with try/catch/finally blocks) within your ASP .NET
application.

In addition, I recommend you the following articles on handling exception
in ASP .NET:

An Exception to the Rule, Part 1
http://msdn.microsoft.com/library/de...us/dnaspnet/ht
ml/asp07232001.asp

An Exception to the Rule, Part 2
http://msdn.microsoft.com/library/de...us/dnaspnet/ht
ml/asp08232001.asp

Hope this helps.

Regards,
HuangTM
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #3

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

Similar topics

28
2089
by: jakk | last post by:
Hello All, I have a question about how to handle exceptions. Iam working on an ASP.NET application which has a presentation layer, Business Layer and DataAccess Layer. Iam confused about where to handle exceptions. Say forexample I have a requirement where certain value has to be between 30-72 only and Iam doing this validation in the the BL. if the value is not between 30-72 then Iam throwing an exception back to the UI layer. Is this...
2
5875
by: Rajeev Soni | last post by:
Hi, Considering the scenario for handling exceptions in Web Application where we have Presentation layer, Business layer and Data Access layer; if there any exception is occurred in DAL, what is the best thing to do: 1. Dont catch the exception in DAL and let it prop up to the Application level and the Global.Application_Error event log it to any source and show let ASP.NET show custom error page provided in Web.Config file. OR 2....
3
3040
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
1
4323
by: Eric Gibson | last post by:
Hey, I want to be able to get a sensible exception message that I can actually use to fix my code using asp.net... I was able to set up the Application_Error event, and email exceptions to myself, but they only include "Message" and "StackTrace"... Every email I've gotten includes no information about the error in a way that would help me fix it. I've tried using "GetBaseException", and "InnerException"... But all I get are emails...
6
1145
by: Leon | last post by:
how do I get just the "System.Exception: The subdomain does not exist" message and not the following from a unhandle exception? System.Exception: The subdomain does not exist at vip.header.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\vip\index\controls\header.ascx.vb:line 92 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at...
2
1867
by: lucy | last post by:
Hi, I'm working on a multi-threading web application. I'm using Application_Error event to write exception detail to windows event log to help debug. It seems exception happened in the second thread doesn't fire this event. I tried to use trace.write() method. It doesn't seem work either. I'm out of idea. Any help is highly appreciated. Lucy
2
2683
by: Brad Baker | last post by:
I'm trying to create a custom ASP.NET custom error page however I am having some problems. Here is what I have done: 1) I've created a page called default.aspx with the following code to stimulate an error:
0
1297
by: fergallydon | last post by:
Hi, I'm trying to implement some centralised exception handling and logging in the Application_Error() event of global.asax. If the code that generates the exception is not inside a try-catch block then Application_Error() runs correctly. However, I want to use a try-catch-finally. I want to do some stuff in the catch block before re-throwing the exception. In this case the exception is correctly caught by the catch but even though I...
2
4738
by: Cramer | last post by:
I'm developing a new ASP.NET 3.5 app and I have an http module hooked up to Application_Error that logs detailed exception data. When it parses and evaluates unhandled exceptions, it "sees" all exceptions as type "System.Web.HttpUnhandledException", with the message: "Exception of type 'System.Web.HttpUnhandledException' was thrown." At the same time and for the exact same exception, on my development computer, ASP.NET shows a very...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
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
10635
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
10378
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
10115
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
6881
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
5550
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
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
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

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.