Results 1 to 2 of 2

Thread: web service over ssl [resolved]

  1. #1

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    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:
    1. Dim MyCertificatePolicy As System.Net.ICertificatePolicy
    2.  
    3.         ServicePointManager.CertificatePolicy = MyCertificatePolicy
    4.  
    5.         Try
    6.  
    7.             Dim myRequest As WebRequest = WebRequest.Create("https://katiya.homedns.org/KCMWS/KCSWS.asmx")
    8.             Dim myResponse As WebResponse = myRequest.GetResponse()
    9.  
    10.  
    11.             'ProcessResponse(myResponse)
    12.             'public bool CheckValidationResult(ServicePoint sp, X509Certificate cert,WebRequest req, int problem)
    13.             MyCertificatePolicy.CheckValidationResult(ServicePointManager.CertificatePolicy, X509Certificate, myRequest, 9) = True
    14.             myResponse.Close()
    15.  
    16.         Catch ex As WebException
    17.             If ex.Status = WebExceptionStatus.TrustFailure Then
    18.                 ' Code for handling security certificate problems goes here.
    19.                 Response.Write(ex.ToString())
    20.             End If
    21.             ' Other exception handling goes here
    22.         End Try
    23.  
    24. '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

  2. #2

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539
    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
  •  



Click Here to Expand Forum to Full Width