Can we set the ExceptionMessage in replace handler using resource files?

Aug 31, 2009 at 11:52 AM

Can we set the ExceptionMessage in replace handler (Enterprise library) using resource files? if yes how?

I have an application named ResourceExample. This has a App_GlobalResources folder containing the MyResourceabc.resx which contains mapping of "

ErrorMessage" to "Server Not found" String.

In the Web config file:


In the Default.aspx, i am throwin this error on button click for testing,

ArgumentNullException ex = new ArgumentNullException("ErrorMessage");

throw ex;

But its not picking the Error String from the resource file!!

Please let me know if there is some thing which i did wrong...

Thanks in advance for the help,


Aug 31, 2009 at 11:56 AM
Here is what is there in config file for exception handling...
      <add name="ExceptionPolicy">
          <add type="System.ArgumentNullException, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="ThrowNewException" name="ArgumentNullException">
              <add exceptionMessage="" exceptionMessageResourceName="MyResourceabc"
                exceptionMessageResourceType="Resources.MyResourceabc, App_GlobalResources.ha-7fil4, Version=, Culture=neutral, PublicKeyToken=null"
                replaceExceptionType="System.Exception, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
                type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ReplaceHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                name="Replace Handler" />