|
-
May 9th, 2004, 09:17 AM
#1
Thread Starter
Fanatic Member
web service over ssl [resolved]
hey all right im trying to access my webservice on my production server and the cert is not a trusted cert so imagine going to a website with an untrusted cert you get a promt saying allow YES or NO ,,,,,, same applies to the webservice so i need to programiticly press the yes button, ive found lots of examples and i think im nearly there however i need help on the cert part.... HERES the code
VB Code:
Dim MyCertificatePolicy As System.Net.ICertificatePolicy
ServicePointManager.CertificatePolicy = MyCertificatePolicy
Try
Dim myRequest As WebRequest = WebRequest.Create("https://katiya.homedns.org/KCMWS/KCSWS.asmx")
Dim myResponse As WebResponse = myRequest.GetResponse()
'ProcessResponse(myResponse)
'public bool CheckValidationResult(ServicePoint sp, X509Certificate cert,WebRequest req, int problem)
MyCertificatePolicy.CheckValidationResult(ServicePointManager.CertificatePolicy, X509Certificate, myRequest, 9) = True
myResponse.Close()
Catch ex As WebException
If ex.Status = WebExceptionStatus.TrustFailure Then
' Code for handling security certificate problems goes here.
Response.Write(ex.ToString())
End If
' Other exception handling goes here
End Try
'vbf note: - You have to import system.net
according to msdn lib i need to get the certs name
msdn link ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetICertificatePolicyClassCheckValidationResultTopic.htm
So how do i get the cert i want to validate ?????
Last edited by carlblanchard; May 9th, 2004 at 10:56 AM.
I am curretly building a defect management system for software and web developers,
If you wana try it out (beta test) and keep it for free just send me a message
-
May 9th, 2004, 10:56 AM
#2
Thread Starter
Fanatic Member
found the answer
Public Class TrustAllCertificatePolicy
Implements System.Net.ICertificatePolicy
Public Function CheckValidationResult(ByVal srvPoint As ServicePoint, ByVal certificate As System.Security.Cryptography.X509Certificates.X509Certificate, ByVal request As WebRequest, ByVal certificateProblem As Integer) As Boolean Implements System.Net.ICertificatePolicy.CheckValidationResult
Return True
End Function
End Class
I am curretly building a defect management system for software and web developers,
If you wana try it out (beta test) and keep it for free just send me a message
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|