dcsimg
Results 1 to 3 of 3

Thread: SSL unexpectedly stoped work in app, but open fine in browser and cert is valid

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Posts
    71

    SSL unexpectedly stoped work in app, but open fine in browser and cert is valid

    SSL unexpectedly stopped working in app, but SAME LINK OPENS FINE IN BROWSER and cert is valid.

    Everything was working fine for 2 years without interruptions, now
    the exact error after getting webresponse during debugging is

    "The request was aborted: Could not create SSL/TLS secure channel"

    my code:
    ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf CertificateValidation)

    Try
    webRequest = WebRequest.Create("https://websitename.com/update.html")
    webresponse = webRequest.GetResponse() 'EXCEPTION HERE
    inStream = New StreamReader(webresponse.GetResponseStream())
    cr = inStream.ReadToEnd()
    inStream.Close()
    webresponse.Close()
    Dim regMatch1 As New Regex("\d+")
    cr = regMatch1.Match(cr).ToString
    Catch ex As Exception
    RichTextBox1.AppendText(vbCr + "Error connecting to server!" + vbCr)
    End Try

    Private Shared Function CertificateValidation(ByVal sender As Object, ByVal cert As X509Certificate, ByVal chain As X509Chain, ByVal [error] As System.Net.Security.SslPolicyErrors) As Boolean
    If cert.Subject.Contains("OU=PositiveSSL") Then
    Return True
    Else
    Return False
    End If
    End Function

  2. #2
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,580

    Re: SSL unexpectedly stoped work in app, but open fine in browser and cert is valid

    What version of Visual Studio/.NET are you using?

    Recently there was a major change in how payment processors certify encryption, and a higher standard for SSL/TLS was adopted. This means most websites had to change to use the new standard.

    Versions of .NET (and actually Windows) earlier than a certain point cannot support this version of TLS.

    This blog article suggests .NET 4.6 supports it out of the box, 4.5 requires configuration, 4.0 only supports it if you've installed 4.5, and there is no way to make 3.5 or earlier support these versions of TLS, but MS chickened out and some patch for 3.5 makes it possible but isn't explained on that site.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Posts
    71

    Re: SSL unexpectedly stoped work in app, but open fine in browser and cert is valid

    Im using 2017 COmmunity Edition/NET 4.6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width