Problems with Security Certificates and Secure Servers

Discussion in 'ASP .Net' started by leeo, Jun 29, 2006.

  1. leeo

    leeo Guest

    Hi

    We're using the following code to send data to a secure server and then
    get a response back from it:

    System.Net.ServicePointManager.CertificatePolicy = New
    cCertificatePolicy

    wr = CType(WebRequest.Create(goSettings.NHSDPBClaimsURL),
    HttpWebRequest)
    nc = New NetworkCredential(goSettings.NHSUserName,
    goSettings.NHSPassword)

    wr.Credentials = nc
    wr.ContentType = "text/xml"
    wr.Method = "POST"

    xd = New XmlDocument
    xd.Load(gsAppPath & "\temp.xml")

    xw = New XmlTextWriter(wr.GetRequestStream(), Nothing)

    xd.WriteTo(xw)

    xw.Close()

    ws = CType(wr.GetResponse(), HttpWebResponse) <-- problem
    here

    sr = ws.GetResponseStream()

    rd = New StreamReader(sr)

    Now at first we had a hell of a time just being able to connect to the
    server until we found some useful tips on google groups about setting
    up our own certificate policy which always returns true on the
    CheckValidationResult method. This now allows us to send the data to
    the server correctly, however when it reaches the line that gets a
    reponse from the server, it falls over with the same old "Could not
    establish secure channel for SSL/TLS" even though it has clearly run
    the new policy and already uploaded data to using the webrequest
    object. The strange thing is, if the whole routine is run again by
    pressing the send button a second time it works fine.

    Does anyone know why we would be getting this problem, or a method to
    correct it?

    Thanks

    Lee
     
    leeo, Jun 29, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. A.M
    Replies:
    5
    Views:
    5,445
    Teemu Keiski
    Jun 8, 2004
  2. zdrakec
    Replies:
    1
    Views:
    436
    zdrakec
    Jul 25, 2005
  3. Aaron
    Replies:
    1
    Views:
    353
    John C. Bollinger
    Aug 4, 2003
  4. gilman
    Replies:
    0
    Views:
    361
    gilman
    Nov 24, 2006
  5. n33470

    Are SSL certificates and x.509 certificates the same?

    n33470, Dec 14, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    185
    n33470
    Dec 14, 2005
Loading...

Share This Page