开发者

Ignoring SSL certificate error for HttpWebRequest in Dynamics AX 2009

开发者 https://www.devze.com 2023-03-19 03:23 出处:网络
I\'m in a need to bypass certificate error on HttpWebRequest used in Dynamics AX 2009. I found some fancy code that works perfectly fine in .NET:

I'm in a need to bypass certificate error on HttpWebRequest used in Dynamics AX 2009. I found some fancy code that works perfectly fine in .NET:

private bool ValidateCert(object sender,   
    X509Certificate cert,   
    X509Chain chain,   
    System.Net.Security.SslPolicyErrors error)  
{  
    return true;  
}  

private void Form1_Load(object sender, EventArgs e)  
{  
    System.Net.ServicePointManager.ServerCertificateValidationCallback +=   
        new System.Net.Security.RemoteCertificateValidationCallback(ValidateCert);  
} 

However it does seem like System.Net.Security.RemoteCertificateValidationCallback cannot be accessed through Dynamicx AX. Is there any workaround for it to work? (except of making .NET dll and atatching it to A开发者_StackOverflowxapta)


You could add the invalid certificate to the Local Computer Trusted Root Certification Authorities (answer stolen from Using a self-signed certificate with .NET's HttpWebRequest/Response).

The tricky part in Ax is to install it at the proper place and give the Ax user access to it (especially if you call the web service from the AOS).

If you call the web service from the client, you need to install it on all clients (or call code on AOS that makes the call and install the certificate on the server).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号