When I test on my local computer, it's English.
When I deployed to web server located at HK\China, it's gibberish.
I already force the culture info into English, still the same.
I want to log exception in English no matter what, then show exception to user accordingly but not in gibberish.
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
try
{
...
}
catch (SAP.Connector.RfcSystemException rfcSystemException)
{
LogHandler.LogError(logger, "", rfcSystemException);
ShowMessage("RfcSystemException", rfcSystemException.Message);
}
Message: Material XXX not maintained in plant YYY
Error Code: RFC_ERROR_SYSTEM_FAILURE
Source: SAP.Connector.Rfc
Stack trace:
at SAP.Connector.SAPConnection.ThrowRfcException(RFC_ERROR_INFO_EX rfcerrInfo, Encoding encoding, String languangeCode) at SAP.Connector.Rfc.RfcClient.RfcInvoke(SAPClient proxy, String method, Object[] methodParamsIn) at SAP.Connector.SAPClient.SAPInvoke(String method, Object[] methodParamsIn) at DrawingReq_BAPI.SAPProxy1.Zats_Create_Sourcelist(String Material, String Plant, String Purorg, String Valid_From, String Valid_To, String Vendor_Code) at ComparePrice.btnUpload_Click(Object sender, EventArgs e) in d:\TFS\XXX\ComparePrice.aspx.cs:line 688
I was told to use SAP .Net Connector 3.0 to call those RFCs and the exception message caught display accordingly to the language set in connection string, no more gibberish.