Append Text to Existing File on FTP Site

  • I am trying to append text into an existing text file on an FTP site using a script task in SSIS. I get this error when I try to run the code below - "Cannot send a content-body with this verb-type." Any suggestions on what I need to change?

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Runtime

    Public Class ScriptMain

    Public Sub Main()

    Dim File As Net.FtpWebRequest

    Dim FileName As String

    FileName = "Test.txt"

    File = DirectCast(System.Net.FtpWebRequest.Create("ftp://myftpsite.com" & "/" & FileName), System.Net.FtpWebRequest)

    File.Credentials = New System.Net.NetworkCredential("Login", "Password")

    Using strm As IO.StreamWriter = New IO.StreamWriter(File.GetRequestStream())

    strm.WriteLine("Test Line Added")

    strm.Close()

    End Using

    Dts.TaskResult = Dts.Results.Success

    End Sub

    End Class

  • Please don't cross post. All responses are to be posted Here


    Bru Medishetty

    Blog -- LearnSQLWithBru

    Join on Facebook Page Facebook.comLearnSQLWithBru

    Twitter -- BruMedishetty

Viewing 2 posts - 1 through 2 (of 2 total)

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