简体   繁体   English

VB。 NET:请求被中止:无法在 WebClient 上创建 SSL/TLS 安全通道

[英]VB. NET: The request was aborted: Could not create SSL/TLS secure channel on WebClient

I created a program which work flawlessly on my desktop but when I use the same program on my laptop, it doesn't work.我创建了一个可以在我的桌面上完美运行的程序,但是当我在笔记本电脑上使用相同的程序时,它不起作用。 It presents the error "Error: The request was aborted: Could not create SSL/TLS secure channel" on my laptop.它在我的笔记本电脑上显示错误“错误:请求被中止:无法创建 SSL/TLS 安全通道”。 I have checked the internet settings and they're the same as my desktop too.我检查了互联网设置,它们也和我的桌面一样。 The code is below.代码如下。

    Sub CheckUsername(ByVal word As String)
            Dim WC As New WebClient
            WC.Headers.Add("user-agent", " Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0")
            Dim t As Byte() = WC.DownloadData("https://www.google.com/search?q=" & word) 'This is the line that creates the error'
            Dim headers As WebHeaderCollection = WC.ResponseHeaders
            WC.Dispose()

            If headers.Count = 7 Then
                'MsgBox("True")'
            Else
                'MsgBox("False")'
            End If
    End Sub

I have also tried to add these lines at the start as researched, but it didn't fix the error.我也尝试在开始时添加这些行作为研究,但它没有修复错误。

            ServicePointManager.Expect100Continue = True
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
What frameowrk version ur using ? if 4.6 and above that add like this before call that WebClient.
 



ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VB。 NET:请求被中止:无法创建 SSL/TLS 安全通道 - VB. NET: The request was aborted: Could not create SSL/TLS secure channel SOAP错误:请求已中止:无法创建SSL / TLS安全通道 - SOAP Error: The request was aborted: Could not create SSL/TLS secure channel ASP.NET“请求被中止:无法创建 SSL/TLS 安全通道”也出现在配置的 servicepointmanager 中 - ASP.NET "The request was aborted: Could not create SSL/TLS secure channel" occurs also with configured servicepointmanager 该请求已中止:使用X509Certificate2时无法创建SSL / TLS安全通道 - The request was aborted: Could not create SSL/TLS secure channel when using X509Certificate2 VB.NET Web服务无法连接:“无法创建SSL / TLS安全通道” - VB.NET Web Service connection impossible : “Could not create SSL/TLS secure channel” vb无法为SSL / TLS建立安全通道 - vb Could not establish secure channel for SSL/TLS 使用VB.NET检索API JSON(https)(错误:取消了请求:无法创建安全的SSL / TLS通道) - Retrieve API JSON (https) with VB.NET (ERROR: Canceled the request: Unable to create a secure SSL / TLS channel) XmlReader.Create错误“无法创建SSL / TLS安全通道” - XmlReader.Create error “Could not create SSL/TLS secure channel” IIS 阻止我的请求。 无法创建 SSL/TLS 安全通道 - IIS Blocking My Request. Could not create SSL/TLS secure channel 我如何修复 ASP.NET 中的无法创建 SSL/TLS 安全通道错误 - How do i fix the Could not create SSL/TLS secure channel Error in ASP.NET
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM