I want to bypass the SSL certificate error of web service in Windows CE.
There are many solutions for .net Windows applications such as;
Bypass invalid SSL certificate errors when calling web services in .Net
But in windows ce I can not import ServicePointManager library.
So is there another way to do this in Windows CE ?
You can in fact use the ServicePointManager in the CF as well. First, create a policy that accepts everything, as so:
public class TrustAllCertificatePolicy : ICertificatePolicy
{
public TrustAllCertificatePolicy()
{
}
public bool CheckValidationResult(ServicePoint sp,
X509Certificate cert, WebRequest req, int problem)
{
return true;
}
}
To use this class, you should run the following code once per application session (each time the application is started; the TrustAllCertificatePolicy instance will be used each time an SSL connection is made), and before you make any Web requests (preferably on application startup).
System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
This solution is equivalent to answering yes to any security messages that would normally appear in a browser.
More info here
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.