Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# servercertificatevalidationcallback

public class ServicePointManagerX509Helper : IDisposable
{
    private readonly SecurityProtocolType _originalProtocol;

    public ServicePointManagerX509Helper()
    {
        _originalProtocol = ServicePointManager.SecurityProtocol;
        ServicePointManager.ServerCertificateValidationCallback += TrustingCallBack;
    }

    public void Dispose()
    {
        ServicePointManager.SecurityProtocol = _originalProtocol;
        ServicePointManager.ServerCertificateValidationCallback -= TrustingCallBack;
    }

    private bool TrustingCallBack(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
    {
        // The logic for acceptance of your certificates here
        return true;
    }
}
Comment

c# servercertificatevalidationcallback

using (new ServicePointManagerX509Helper())
{
    // Your code here
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: bubble sort recursive c# 
Csharp :: stack iterator c# 
Csharp :: c# string .contains against empty string returns 
Csharp :: open aspx page c# 
Csharp :: enable asnotracking in asp.net core at global level 
Csharp :: c# webclient accept all certificates 
Csharp :: Thread.Sleep() without freezing the UI 
Csharp :: slider script unity 
Csharp :: PUN 2 Network Transform View Jittery Movement 
Csharp :: c# string size in bytes 
Csharp :: asp.net framework mvc cors error axios 
Csharp :: jsonconvert serializeobject and jsonconvert deserialize to list 
Csharp :: input string was not in a correct format convert to double 
Csharp :: use & symbole in xml as a text using c# 
Csharp :: reversing linkedlist C# 
Csharp :: how to make continuous progress bar 
Csharp :: c# call by reference 
Csharp :: c# isalphanumeric 
Csharp :: stateteach.net 
Csharp :: C# program to implement the Quadratic Formula 
Csharp :: C# sprint key 
Csharp :: c# dictionary contain key but returns false 
Csharp :: c# is not 
Csharp :: unity raycast hit child object 
Csharp :: how to authorize token when consuming api in c# 
Csharp :: C# today, yesterday, last week, last month 
Csharp :: getcomponent rigidbody2d 
Csharp :: page refresh on button click in c# 
Csharp :: unity overlapcircle 
Csharp :: what is c# used for 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =