473,387 Members | 1,903 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,387 software developers and data experts.

Application_Error does not fire

For testing purposes I put a
Throw New Exception("Something didn't work right.") on the click of a button
on a page. In the application_error section of my application I have a

Response.Redirect("error.htm")

Later I will had error logging and email functionallity to this but in the
mean time I just need the application to redirect to this error.htm page.
This works perfectly fine in another application I have. It seems like the
Applicaiton_Error is not getting called during an application error.

Thanks
Dec 22 '05 #1
5 3162
One thought: are you sure the button handler code is being called and
actually throwing the exception?

What happens after you click the button? (e.g. Do you get a default
error page?)

- albert

Dec 22 '05 #2
I get the defalut error page that says "Something didn't work right" on the
top. I've put a break point on the Sub Application_Error and nothing ever
happens.
"albert braun" <bc***********************@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
One thought: are you sure the button handler code is being called and
actually throwing the exception?

What happens after you click the button? (e.g. Do you get a default
error page?)

- albert

Dec 22 '05 #3
more questions:

does the "Something didn't work right" error message in that page
something like this:
Line 4:
Line 5: Protected Sub Button1_Click(ByVal sender As Object, ByVal
e As System.EventArgs) Handles Button1.Click
Line 6: Throw New Exception("generated by my VB Test page.")
Line 7:
Line 8: End Sub

i mean, are you seeing the very same exception you intentionally threw
in the button click handler? or is there something else wrong?

is your Application_Error method defined in the Global.asax file (or if
using codebehind, the Global.asax.vb file)?

Dec 22 '05 #4
Are you clearing out the errors afterwards?

"Andy G" <aj*****@iastate.edu> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
For testing purposes I put a
Throw New Exception("Something didn't work right.") on the click of a
button on a page. In the application_error section of my application I
have a

Response.Redirect("error.htm")

Later I will had error logging and email functionallity to this but in the
mean time I just need the application to redirect to this error.htm page.
This works perfectly fine in another application I have. It seems like
the Applicaiton_Error is not getting called during an application error.

Thanks

Dec 22 '05 #5
The code is below for both locations. I'm starting to think it has
something to do with settings in IIS or on the server.
Code that throws the error.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Throw New Exception("Something didn't work right.")

End Sub
Code in the Application_Error event that resides in my Global.asax.vb

Server.ClearError()

Response.Redirect("error.htm")

"Marina" <so*****@nospam.com> wrote in message
news:Og**************@tk2msftngp13.phx.gbl...
Are you clearing out the errors afterwards?

"Andy G" <aj*****@iastate.edu> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
For testing purposes I put a
Throw New Exception("Something didn't work right.") on the click of a
button on a page. In the application_error section of my application I
have a

Response.Redirect("error.htm")

Later I will had error logging and email functionallity to this but in
the mean time I just need the application to redirect to this error.htm
page. This works perfectly fine in another application I have. It seems
like the Applicaiton_Error is not getting called during an application
error.

Thanks


Dec 27 '05 #6

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

Similar topics

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: Ken Dopierala Jr. | last post by:
Hi, I'm having a problem where my Application_Error() event in my Global.asax file isn't firing in Release Mode. If I compile in Debug it fires just fine, but if I then recompile in Release it...
0
by: Phil | last post by:
I'm trying to add custom error handling for a 401 error. I've added this to my web.config: <location path="admin"> <system.web> <authorization> <allow roles="\" /> <deny users="*" />...
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...
6
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...
0
by: Ralfie | last post by:
I have both an web project and an webservice project in my solution. When I recive and errror in my web project my Application_error in global.aspx.cs is fired. This doesnt happend in my web...
1
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...
5
by: jobs | last post by:
re: try catch finally to close and dispose, but still want Application_error to fire 1. If catch an exception to to dispose and close of a ado connect, how can I allow the exception to still...
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,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.