c# - How to write this line in C++/CLI? -


i'm using visual c++ call web service. need bypass invalid ssl certificates since i'm getting error -

the request failed. underlying connection closed: not establish trust relationship ssl/tls secure channel.

while writing same thing in c#, used line -

system.net.servicepointmanager.servercertificatevalidationcallback = delegate { return true; }; 

and worked me.

how achieve same thing in visual c++? how write same line in visual c++?

you need create callback object explicitly , assign corresponding property.

using namespace system; using namespace system::net; using namespace system::net::security; using namespace system::security::cryptography::x509certificates;   static bool validateservercertificate(         object^ sender,         x509certificate^ certificate,         x509chain^ chain,         sslpolicyerrors sslpolicyerrors)     {         return true;     }  int main(array<system::string ^> ^args) {     // create callback object, pointing function     system::net::security::remotecertificatevalidationcallback^ clb = gcnew remotecertificatevalidationcallback(validateservercertificate);     // assign property     system::net::servicepointmanager::servercertificatevalidationcallback = clb;      return 0; } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -