Solved

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

Posted on 2014-10-29
3
1,032 Views
Last Modified: 2014-11-10
im trying to call this url
gateway.sandbox.push.apple.com:2195


 using this code

  Dim request As HttpWebRequest = TryCast(HttpWebRequest.Create("https://gateway.sandbox.push.apple.com:2195"), HttpWebRequest)

        If request IsNot Nothing Then
            request.Method = "GET"
            request.KeepAlive = False
            request.ProtocolVersion = HttpVersion.Version10
            Dim webProxy = New System.Net.WebProxy("ip address", True)
            Dim credentials = New NetworkCredential("user name", "password", "domain")

            webProxy.Credentials = credentials
            request.Proxy = webProxy
            Try
                Using response As WebResponse = request.GetResponse()
                    Using stream As Stream = response.GetResponseStream()
                        Using reader As New StreamReader(stream, Encoding.UTF8)
                            content = reader.ReadToEnd()
                        End Using
                    End Using
                End Using
            Catch exc As Exception
                Throw exc
            End Try
        End If

Open in new window


and it is not working

i did the following
    ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf AcceptAllCertifications)
       

   Dim cert As X509Certificate2 = New X509Certificate2(Server.MapPath("mycert.p12"), "password")

and add it to the request but no luck

pls help
0
Comment
Question by:Kamal Khaleefa
  • 2
3 Comments
 
LVL 80

Expert Comment

by:David Johnson, CD, MVP
ID: 40412402
I can't get push.apple.com to resolve doing a ns lookup can you?
0
 
LVL 16

Accepted Solution

by:
Kamal Khaleefa earned 0 total points
ID: 40425683
Hi

i solve the problem doing this
 Try


            ServicePointManager.Expect100Continue = False

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls



            Dim request As HttpWebRequest = WebRequest.Create("https://mysiteaddress")

            request.ProtocolVersion = HttpVersion.Version10
            request.KeepAlive = False


            ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf AcceptAllCertifications)

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls





            Dim cert As X509Certificate2 = New X509Certificate2("mycertification path", "password") 'if needed


            request.ClientCertificates.Add(cert)

            request.Method = "POST"


            Dim webProxy = New System.Net.WebProxy("my proxy address if required", True)

            Dim credentials = New NetworkCredential(proxyUserName, proxyPassword, DomainName)


            webProxy.Credentials = credentials ' CredentialCache.DefaultCredentials '; credentials


            request.Proxy = webProxy


            Dim responseStream = request.GetRequestStream

            Debug.Assert(responseStream IsNot Nothing)

         

        




        Catch ex As Exception



        End Try

Open in new window

0
 
LVL 16

Author Closing Comment

by:Kamal Khaleefa
ID: 40432348
This solution works
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question