Solved

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

Posted on 2014-10-29
3
948 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 79

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now