I have hit the same problem...
I am trying to implement a financial gateway system, which uses WSE 1.0 SP1, and the sample code provided makes an SSL connection to their server. So, I have to find a way to override the System.Net.ICertificatePolicy so as to always approve SSL certs.
I am running ASP.NET (VB) .NET version 1.1, and am having a hard time getting your code to work, and was wondering if you had any suggestions.
I put your class above my class (in a code-behind page which inherits the page) thusly:
Public Class MyCertificateValidation
Implements System.Net.ICertificatePolicy
'This class handles problems with certificates if ssl (https) is used
Public Function CheckValidationResult(ByVal srvPoint As ServicePoint, _
ByVal cert As X509Certificate, ByVal request As WebRequest, ByVal problem As Integer) _
As Boolean Implements ICertificatePolicy.CheckValidationResult
Return True ' Accept all certificates
End Function
End Class
Public Class thepage
' Inherit the page
Inherits Page
.
.
.
Everything looks good, but I get this error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30149: 'MyCertificateValidation' must implement 'Overridable Function CheckValidationResult(srvPoint As ServicePoint, certificate As Security.Cryptography.X509Certificates.X509Certificate, request As WebRequest, certificateProblem As Integer) As Boolean' for interface 'System.Net.ICertificatePolicy'.
Source Error:
Line 26:
Line 27: Public Class MyCertificateValidation
Line 28: Implements System.Net.ICertificatePolicy
Line 29:
Line 30: 'This class handles problems with certificates if ssl (https) is used
However, it clearly DOES overright it... and I am stumped. :confused:
Any ideas anyone?
Thanks in advance.