這是跟SSL有關的問題

先寫一個Class
 internal class AcceptAllCertificatePolicy : ICertificatePolicy
 {
     public AcceptAllCertificatePolicy()
    {
     }

     public bool CheckValidationResult(ServicePoint sPoint, System.Security.Cryptography.X509Certificates.X509Certificate cert, 
     WebRequest wRequest, int certProb)
    {
          // Always accept
          return true;
    }
 }

然後再發送Request之前寫下面這行
System.Net.ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();

welkingunther 發表在 痞客邦 PIXNET 留言(0) 人氣()