I want to use https to upload a file using WebClient's UploadData method. And I want to ignore server side certificate verification (always accept server certificate and only use encryption feature of https).
I have tried hard but cannot find a similar sample. Could anyone advise me how to implement? Any reference samples?
I am using VSTS2008 + C# + .Net 3.5. Target server is running with IIS 7.0 + Windows Vista x64.
Try adding this before you send you HTTPS requests (make sure you import System.Net
namespace).
ServicePointManager.ServerCertificateValidationCallback +=
delegate(object sender, X509Certificate certificate, X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
return true;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With