cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
201
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: Erick Wellnitz on 25-10-2013 12:30:06 PM
So, the following has been obsolete since .NET 2.0 yet Cisco's documentation keeps using this code. 
1public AXLAPIService(string ccmIp, string user, string password)   
2{       
3  System.Net.ServicePointManager.CertificatePolicy = new BruteForcePolicy();       
4  this.Url = "https://" + ccmIp + ":8443/axl/";       
5  this.Credentials = new System.Net.NetworkCredential(user, password);   
6}
When using this code from documentation the following warning is given:

Warning 1 'System.Net.ServicePointManager.CertificatePolicy' is obsolete: 'CertificatePolicy is obsoleted for this type, please use ServerCertificateValidationCallback instead. [url=http://go.microsoft.com/fwlink/?linkid=14202']http://go.microsoft.com/fwlink/?linkid=14202' C:\VS Projects\AXLAPIService\AXLAPIService\AXLAPIService.cs 1751 9 AXLAPIService

Would anyone be able to guide me in changing the Cisco documented code to the new ServerCertificateValidationCallback?  I'm not quite understanding how to change this based on microsoft's documentation.

Subject: RE: C#Proxy class and Cisco's obsolete code
Replied by: MARIO POIER on 05-11-2013 09:50:37 AM
This is in VB.NET...

Create a new class:
Imports System.Net
Imports System.Net.Security
Imports System.Security.Cryptography.X509Certificates
Public NotInheritable Class SSLValidator   
    Private Sub New()   
    End Sub
   
    Private Shared Function OnValidateCertificate(sender As Object, certificate As X509Certificate, chain As X509Chain, sslPolicyErrors As SslPolicyErrors) As Boolean       
     Return True   
    End Function   

    Public Shared Sub OverrideValidation()
        ServicePointManager.ServerCertificateValidationCallback = AddressOf OnValidateCertificate
        ServicePointManager.Expect100Continue = True   
    End Sub
End Class

Then modify the code you'd used ealier to the following:
Public Sub New(ccmIp As String, user As String, password As String)       
        SSLValidator.OverrideValidation()       
        Me.Url = "https://" & ccmIp & ":8443/axl/"
        Me.Credentials = New System.Net.NetworkCredential(user, password)   
End Sub

I am curious to know how long it takes for the connection to the CUCM server to occur. For me it is ~40 seconds and I can't figure out why?
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links