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:
00834444
Vues:
26
>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...

Hey, we're making progress, Rick.

It *doesn't* like the ToString(). However, when I throw an ApplicationException, the Message property is giving me just "Error in the application" and no other details. The docs confirm your assertion: "The value of the Message property is included in the information returned by ToString", but that's not what I'm getting. FWIW, in previous testing InnerException.ToString() *was* giving me detailed error information. If I instead throw an Exception (instead of the ApplicationException I've been using), the Message property is returning "Exception of type System.Exception was thrown."

The Redirect is working fine, other than the fact that the message being passed isn't very helpful.

What I did to work around this, and to ensure that the InnerException.ToString() is what I want to get, I stored the InnerException as a session variable in the Application_Error method, then retrieve it from the error.aspx page, and then call ToString(). This works, but considering that what I *want* to do is log this information *from* the Aplication_Error method...

[posted later]

I created an exception-handler utility class (not as fancy as yours, I'm sure <s>), thinking that if the Application_Error wasn't happy with me trying to call InnerException.ToString(), I'd just pass the InnerException to the exception handler.

No joy. It still barfs when it hits the ToString(). It looks as though you can't call InnerException.ToString() anywhere in Application_Error or any method called therefrom.

Frustrating.
>>-Steve->>

Steve Sawyer
Geeks and Gurus, Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform