Solved

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

Posted on 2014-10-29
3
1,078 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 81

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

How to Defend Against the WCry Ransomware Attack

On May 12, 2017, an extremely virulent ransomware variant named WCry 2.0 began to infect organizations. Within several hours, over 75,000 victims were reported in 90+ countries. Learn more from our research team about this threat & how to protect your organization!

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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