Upload a text file to HTTPS from SSIS

  • I have script task that upload a file to https. I have no error when the script task is executed. But the file is not received at https web server.

    * I could download a file from https but my file is uploaded. PLease help me out. Here is my script.

    Public Sub Main()

    '

    ' Add your code here

    '

    Dim WebConnection As New WebClient()

    Dim connectionString As String

    Dim creds As New NetworkCredential("username", password")

    connectionString = "https://abc.com/out"

    Try

    With WebConnection

    .BaseAddress = connectionString

    .Credentials = creds

    End With

    Catch ex As Exception

    Dts.Events.FireError(0, "Problem connecting to website: ", ex.Message, "", 0)

    End Try

    Try

    With WebConnection

    .UploadFile(connectionString, "C:\text.txt")

    End With

    Catch ex As Exception

    Dts.Events.FireError(0, "Problem downloading file: ", ex.Message, "", 0)

    End Try

    Dts.TaskResult = ScriptResults.Success

    End Sub

    Is there other ways to upload a file to HTTPS via SSIS?

  • This script worked for me, here is what I changed:

    Added:

    Imports System.Net

    and changed the following line:

    Dim creds As New NetworkCredential("username", "password")

    After I made those changes and put in the appropriate credentials, worked like a charm.

    Thanks

  • Thank you. I installed WINSCP and called the program from script task. It works for me.

  • Hi All

    I am new to SSIS and I need to work on uploading a csv file which contains the records downloaded from a database table.

    The size of the csv file comes closed to 40MB. So I need to upload the csv file to REST endpoint with UTF-8 encoding without Byte Order Mark.

    Can someone help me with the  code that needs to be written in the Script task.

    Thanks

    Abhijith

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply