Home All Groups Group Topic Archive Search About

Application_Error does not fire

Author
22 Dec 2005 6:11 PM
Andy G
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

Author
22 Dec 2005 7:02 PM
albert braun
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
Are all your drivers up to date? click for free checkup

Author
22 Dec 2005 7:06 PM
Andy G
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.


Show quoteHide quote
"albert braun" <bcaguard2000-googlegro***@yahoo.com> wrote in message
news:1135278149.195715.224070@g47g2000cwa.googlegroups.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
>
Author
22 Dec 2005 8:44 PM
albert braun
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)?
Author
22 Dec 2005 8:46 PM
Marina
Are you clearing out the errors afterwards?

Show quoteHide quote
"Andy G" <ajgo***@iastate.edu> wrote in message
news:%23AqPiMyBGHA.1312@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
>
>
Author
27 Dec 2005 6:54 PM
Andy G
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")



Show quoteHide quote
"Marina" <someone@nospam.com> wrote in message
news:OgSpBjzBGHA.4004@tk2msftngp13.phx.gbl...
> Are you clearing out the errors afterwards?
>
> "Andy G" <ajgo***@iastate.edu> wrote in message
> news:%23AqPiMyBGHA.1312@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
>>
>>
>
>

Bookmark and Share