Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set ServicePointManager.ServerCertificateValidationCallback in web.config

Tags:

c#

How do I set this in web.config file

ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) =>true;
like image 410
shikha goyal Avatar asked Dec 02 '14 06:12

shikha goyal


People also ask

What is System Net ServicePointManager ServerCertificateValidationCallback?

ServicePointManager. ServerCertificateValidationCallback is a function, that is used to validate a server certificate. Our application uses custom validation by the client.

What does ServerCertificateValidationCallback do?

An application can set the ServerCertificateValidationCallback property to a method to use for custom validation by the client of the server certificate.


1 Answers

Try this;

Write your code in Application_Start of Global.asax.

It should work..!!!

OR

In Config file;

<configuration>
 <system.net>
   <settings>
     <servicePointManager
        checkCertificateName="false"
        checkCertificateRevocationList="false"         
     />
  </settings>
</system.net>
</configuration> 

you can also VISIT MSDN for the same.

like image 67
H. Mahida Avatar answered Sep 19 '22 19:09

H. Mahida