Re: Error Handling not Working ASP.NET

From: Matt Berther (mberther_at_hotmail.com)
Date: 05/13/04


Date: Thu, 13 May 2004 02:37:53 -0600

Your code could easily get stuck in a loop in the error handler...

ie: any unhandled exception goes to Application_Error, including any
exceptions thrown in Application_Error.

I've been bitten by this a few times. ;) Best thing to do, is check for
nulls where you can and put a try/catch around everything. An error in
the error handler is pretty pointless.

--
Matt Berther
http://www.mattberther.com
Rob wrote:
> Matt unfortunately this did not work, same result, why would my code
> get it stuck in a loop in the first place?
> 
> 
> 
> Matt Berther <mberther@hotmail.com> wrote in message news:<u9Sgps5NEHA.3988@tk2msftngp13.phx.gbl>...
> 
>>I'm guessing youre getting stuck in an endless loop, since something in 
>>your error handler is throwing an error.
>>
>>Try something like this:
>>
>>Dim objErr as Exception = Server.GetLastError()
>>if (objErr <> null) then
>>     ' You could perform some loop in here to iterate through the
>>     ' innerExceptions to get even further into the problem.
>>     Response.Write(objErr.Message)
>>     Server.ClearError()
>>end if
>>
>>--
>>Matt Berther
>>http://www.mattberther.com
>>
>>Rob wrote:
>>
>>>Thank you in advance for your help.
>>>I have a response.redirect in my global.asax.vb file to redirect to
>>>err.aspx page, upon an error the redirect works fine but in the
>>>err.aspx all I simply want to do is write out the error for now and do
>>>a bunch of other stuff later, but with the following code, everytime
>>>the whole web app freezes up and just sits there and nothing happens!!
>>>dim objerr As Exception = Server.GetLastError.GetBaseException
>>>
>>>
>>>        Response.Write(objerr.Message.ToString)
>>>        Server.ClearError()
>>>is there too much info in the objerror? (I created a sql error on
>>>purpose so all the error should say is Invalid Table name)


Relevant Pages

  • Re: AT91R40008 Exception Handling
    ... exception, it just sits there in its infinite loop. ... an interrupt handler can be inserted into the table. ... LDR PC, Undef_Addr ...
    (comp.sys.arm)
  • Re: Try Finally...
    ... Now we can protect every more or less specialized action ... an error indication (exception or error code) has to be ... an according exception handler can be inserted into the code. ... resources, as they are related to specific actions. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Batch file and MFC (Properly Terminating Application)
    ... running any secondary modal loop. ... don't write an OnCancel handler, ... the changes the user thought had been made--because the app closed without ... user clicks on Cancel button and application exits. ...
    (microsoft.public.vc.mfc)
  • Re: WinForms bug? ThreadException not invoked on Exceptions in system code pre-processing the me
    ... Message Queue and invoking the appropriate handler. ... if an Exception is raised during the PRE-PROCESSING of a Windows ... And because any handling will probably fail if there is no memory, the CLR will terminate the application without attempting to call the ApplicationException or UnhandledException events. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: long double versions of functions in gcc under Cygwin
    ... rather than the nearest enclosing one) and a decent exception ... them it doesn't seem like goto usage would be affected ... int typfun() ... Why use a for loop when it is just a while loop in disguise? ...
    (comp.lang.c)