I am trying to catch specific SoapExceptions but cannot find a error code to use.
I have tried getting the error code using;
catch(SoapException e)
{
// Get error code
int ErrorCode = System.Runtime.InteropServices.Marshal.GetExceptionCode(); //System.Runtime.InteropServices.Marshal.GetHRForException(e);
switch (ErrorCode)
{
case -2146233087:
{
// Default parameters have not been established in the report
return "false";
}
default:
{
return "false";
}
}
}
But this does not work. Does anyone know where to look for the error code? The only soloution I can possible think of is doing a string match on
e.GetBaseException().ToString()
but that would be ugly
ANSWER
string ErrorCode = ((e.Detail).FirstChild).InnerText;
string ErrorCode = ((e.Detail).FirstChild).InnerText;
返回“ rsAccessDenied”,这是评估我的错误所需要的。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.