Solved

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

Posted on 2014-10-29
3
908 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 78

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

14 Experts available now in Live!

Get 1:1 Help Now