473,467 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Application_Error and ASP.NET error screen

A.M
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


void Application_Error(Object sender, EventArgs e)

{

Log
(Request.Path,Server.GetLastError().Message,Server .GetLastError().StackTrace
);

Response.Redirect ("genericerror.htm ");
}
Nov 18 '05 #1
2 2996
Hello

better use a
Server.Transfer
You are able to retrieve the exception info there as well!

Regards,

Tom
-----Original Message-----
Hi,

I have the following code in Global.asax. Using a breakpoint, i can see thatthat all errors are being trapped in Application_Error and the event handleris being run properly. The problem is still it shows standard ASP.NET errorscreen. That means Response.Redirect ("genericerror.htm "); is beingignored. How can i fix this problem ?

Thanks,
Allan


void Application_Error(Object sender, EventArgs e)

{

Log
(Request.Path,Server.GetLastError ().Message,Server.GetLastError().StackTrace);

Response.Redirect ("genericerror.htm ");
}
.

Nov 18 '05 #2
Have you put a custom error handler page in your web.config ?

Try adding the following:

<configuration>
<system.web>
<compilation debug="true"/>
<customErrors mode="On" defaultRedirect="genericerror.htm "/>
</system.web>
</configuration>

Application events are generally not used for specific user things
especially redirects. The reason for this is because the application events
and variables are scoped for the entire application, and not any individual
user.

"A.M" <IH*******@sapm123.com> wrote in message
news:Oy**************@TK2MSFTNGP12.phx.gbl...
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


void Application_Error(Object sender, EventArgs e)

{

Log
(Request.Path,Server.GetLastError().Message,Server .GetLastError().StackTrace );

Response.Redirect ("genericerror.htm ");
}

Nov 18 '05 #3

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

Similar topics

1
by: Greg Burns | last post by:
I am trying to write a global custom error page. I thought I would jot down some of what I've learned so far... At first I just used the default customErrors section with a defaultRedirect tag,...
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...
3
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...
2
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...
2
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...
6
by: Matt | last post by:
Can anyone give me a good reason to use BOTH application scope Page_Error and the page scope Page_Error when trapping errors in a web application? Is there any real benefit to using the Page_Error...
2
by: Matt | last post by:
As the subject says... are Application_Error and Page_Error triggered by the same event? In other words, is there any error that could slip by Application_Error but be caught by Page_Error, or...
19
by: =?Utf-8?B?anZjb2FjaDIz?= | last post by:
I've got a global.aspx file that works in my dev environment (vs 2005). When i publish the site to a windows 2000 sp4 box running IIS, the global does not seem to fire. Since it's a test server,...
1
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
I have a web app that handles errors in the Gloabal.ascx's Application_Error(). It does some logging etc in there and if it throws an error, I want the app to display a static html splash page...
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
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...
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
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.