문제

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; 

returned "rsAccessDenied" which is what I needed to evaluate my error.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top