|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Application_Error does not fireFor 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 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 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 > 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)? 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 > > 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 >> >> > >
Other interesting topics
Select string building in C# and ASP.NET
Loading UserControl using New Contructor ..HtmlControls.HtmlInputFile.Saveas(filename) not overwriting need help to convert to VB Storing an array to a Session Virtual Directory How do I run a server side method from javascript?! Path conversion self-signed certificate for Windows XP MessageBox |
|||||||||||||||||||||||