Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic
' The ScriptMain class is the entry point of the Script Task.
Imports System.Net
Imports System.IO
Imports System
Imports System.Data
Imports System.Math
Imports System.Web
Imports System.Object
Imports System.Web.HttpResponse
Imports Microsoft.SqlServer.Dts.Runtime
Public Class ScriptMain
Public Sub Main()
' Dim strFileName As String = System.IO.Path.GetRandomFileName()
Dim URL As String = Dts.Variables("Url").Value.ToString()
Dim strFriendlyName As String = Dts.Variables("Filename").Value.ToString() '"sample.txt"
Dim dir As DirectoryInfo = New DirectoryInfo(Dts.Variables("ImportFolder").Value.ToString())
Dim credentials As System.Net.NetworkCredential = System.Net.CredentialCache.DefaultNetworkCredentials
Dim source As New Uri("https://testportal-ab.abc.net/deps/test/fold/destfold/sample.txt")
' Dim source1 As New Uri(URL & "/" & strFriendlyName & fileExtension)
Dim destination As String = "C:\Users\users1\Desktop\destfold\" & strFriendlyName
My.Computer.Network.DownloadFile(source, destination, credentials, True, 60000I, False)
End Sub
End Class