473,405 Members | 2,344 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,405 software developers and data experts.

Ignore exception in Application_Error event but maintain state

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

Server.ClearError()

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

Server.ClearError();
Response.Redirect(Request.UrlReferrer.ToString());

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 5532
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_Error event in Global.asax.cs file and still
have the page's state be maintained. If I simply issue:

Server.ClearError()

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

Server.ClearError();
Response.Redirect(Request.UrlReferrer.ToString());

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.ClearError(). 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
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...
2
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...
3
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...
1
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...
6
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...
2
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...
2
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...
0
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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,...
0
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...

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.