Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Application level exception handling
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00833443
Message ID:
00834004
Vues:
31
Try using Server.GetLastError().InnerException.Message;

It shouldn't throw an exception from the code you ahve but it sounds like the Exception doesn't like .ToString(). It's the message you want though...

+++ Rick --

>>So what happens if an error occurs?
>
>The default "Error in the application. Description: An unhandled exception occurred..." page.
>
>>The most likely scenario is that you have an error in the error handler in which case you get a standard ASP.Net error behavior that's virtually undistinguishable from the original error.
>
>Sounds like VFP - you can't handle an error when you're in an error condition, huh? <g>
>
>As far as I know, there isn't an error in the Application_Error code, the exception being reported is the exception that I'm explicitly throwing, not an error in Application_Error.
>
>> THe easiest thing to do is set a break poin t the first line and see if it gets there.
>
>No Page_Error, but setting a breakpoint is behaving strangely.
>
>If I set a breakpoint on the first line of code below in my Application_Error...
>
>
>string ErrorDescription = Server.GetLastError().ToString();
>string RedirectString = "Error.axpx?ErrorDescription=" + ErrorDescription;
>Response.Redirect(RedirectString);
>Server.ClearError();
>
>
>The debugger stops at that first line of code, and taking a single step at that point throws me into the default "unhandled exception page". The remaining three lines of code do not appear to execute.
>
>If OTOH, I change the code like this, clearing the error before doing the Response.Redirect():
>
>
>string ErrorDescription = Server.GetLastError().ToString();
>string RedirectString = "Error.axpx?ErrorDescription=" + ErrorDescription;
>Server.ClearError();
>Response.Redirect(RedirectString);
>
>
>The debugger again stops at the first line of code, and taking a single step beyond that is leaving me at the page in which the error occurred, but it's now blank. Again, it would appear that the remaining three lines of code aren't running, so I don't know why the behavior would change.
>
>I have no idea at this point what's going on...
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform