0

我们当前的流程运行良好,并且能够下载文件,直到站点决定切换到 TLS 1.2 协议。现在,我们的文件下载不再起作用。

我们现有的解决方案基于这个 vb.net 解决方案,这似乎无法处理 TLS 下载。我可以看到文件,连接到它,但无法下载。有没有办法在 VB.net 或 C# 中处理这个问题?

4

1 回答 1

0

这对我有用:

    Imports System.Net

    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12

    Dim webclient As New WebClient

    webclient.BaseAddress = Dts.Variables("ServerURL").Value
    WebClient.Credentials = New NetworkCredential(Dts.Variables("ServerUsername").Value.ToString, Dts.Variables("ServerPassword").Value.ToString)

    Dim filename As String = "C:\Temp\Sample.txt"
    WebClient.DownloadFile(Dts.Variables("ServerURL").Value, filename)
于 2018-04-03T11:48:25.093 回答