So the System.Net.ServicePointManager has the function, to add a callback method for the ServerCertificateValidationCallback method/event
I want to add my own callback method to this in x++.
The background is the following post, where this is appearently done in AX2012:
https://community.dynamics.com/ax/b/dynamicsax_wpfandnetinnovations/archive/2012/11/25/making-calls-to-secure-web-services
In AX 2012 it can be done the following way:
System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate(object sender,
System.Security.Cryptography.X509Certificates.X509Certificate certificate,
System.Security.Cryptography.X509Certificates.X509Chain chain,
System.Net.Security.SslPolicyErrors sslPolicyErrors) { return true; };
This is not possible to do the same way in D365FO/AX7.
The += operator is only allowed with the eventhandler(...) pattern, not with delegate(...)
I have tried several takes, including trying to create a new System.Net.Security.RemoteCertificateValidationCallback object, but can't find a way to make it even compile.
Does anyone have experience with this?
I would prefer to keep the code in x++, and not having to make it in c#, but if that's the only option I may have to go for the red pill
Kind Regards
Tommy Axelgaard