[Solved] HTTPS Without SSL Web service Call in asp.net c#


HTTPS Without SSL Web service Call in asp.net c#

Here I will explain how to call a HTTPS URL (may be a web service or web api) that hosted and dos not have any valid SSL certificate. While we are taking a website through browser, we need to add exception while accessing a secure website without a valid SSL certificate.



HTTPS web service call solution asp.net c#

In case of asp.net programming, we also need to accept of certificates that coming from the website before the call. For that we need to create following method that return a boolean result.

 private bool AcceptAllCertifications(object sender,
System.Security.Cryptography.X509Certificates.X509Certificate certification,
System.Security.Cryptography.X509Certificates.X509Chain chain,
System.Net.Security.SslPolicyErrors sslPolicyErrors)
 {
 return true;
 }


After that before calling the web service you need to do below certification validation call back check.

System.Net.ServicePointManager.ServerCertificateValidationCallback =
 new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications);


[Solved] HTTPS Without SSL Web service Call in asp.net c# [Solved] HTTPS Without SSL Web service Call in asp.net c# Reviewed by Tech Doubts on 8:14 AM Rating: 5

No comments:

Powered by Blogger.