简体   繁体   English

使用SSIS从TLS1.2站点下载文件

[英]File downloads from a TLS1.2 site using SSIS

Our current process was working fine and was able to download files until the site decided to switch to TLS 1.2 protocol. 我们当前的过程运行良好,并且能够下载文件,直到站点决定切换到TLS 1.2协议为止。 Now, our file downloads no longer work. 现在,我们的文件下载不再起作用。

Our existing solution is based on this vb.net solution and this does not seem to handle TLS downloads. 我们现有的解决方案基于此vb.net解决方案,并且似乎无法处理TLS下载。 I can see the file, connect to it but cant download it. 我可以看到该文件,请连接到它,但无法下载。 Is there a way to handle this in either VB.net or C#? 有没有办法在VB.net或C#中处理此问题?

This worked for me: 这对我有用:

    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)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM