Bypass invalid SSL certificate errors when calling web services in .Net

前端 未结 8 805
栀梦
栀梦 2020-11-28 20:33

We are setting up a new SharePoint for which we don\'t have a valid SSL certificate yet. I would like to call the Lists web service on it to retrieve some meta data about th

相关标签:
8条回答
  • 2020-11-28 21:26

    The approach I used when faced with this problem was to add the signer of the temporary certificate to the trusted authorities list on the computer in question.

    I normally do testing with certificates created with CACERT, and adding them to my trusted authorities list worked swimmingly.

    Doing it this way means you don't have to add any custom code to your application and it properly simulates what will happen when your application is deployed. As such, I think this is a superior solution to turning off the check programmatically.

    0 讨论(0)
  • 2020-11-28 21:26

    I was having same error using DownloadString; and was able to make it works as below with suggestions on this page

    System.Net.WebClient client = new System.Net.WebClient();            
    ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
    string sHttpResonse = client.DownloadString(sUrl);
    
    0 讨论(0)
提交回复
热议问题