Enterprise Library: Exception Handling Block - how do I get to HandlingInstanceID?


L

levon

How to I get to the HandlingInstanceID from my code. I get it inside my
exception message but I don't see a way to get to it from my web page.

Thanks.
 
Ad

Advertisements

Joined
Dec 23, 2014
Messages
2
Reaction score
0
If you are using a ReplaceHandler, you can actually put the handlingInstanceID in your custom error message:

<exceptionHandling>
<exceptionPolicies>
<add name="ReplacingException">
<exceptionTypes>
<add name="Exception" type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
postHandlingAction="ThrowNewException">
<exceptionHandlers>
<add name="Replace Handler" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ReplaceHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling"
exceptionMessage="An application error occurred and has been logged with error code: {handlingInstanceID}"
exceptionMessageResourceName="" exceptionMessageResourceType=""
replaceExceptionType="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
</exceptionPolicies>
</exceptionHandling>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top