I need to create a csv file to an ftp server but failed to make it.

As information, the server required login credential.

Any help?

you will have to change the permissions on the folder, or set the certain permissions within ASP.NET. I cannot see your code or whether or not it is done programmatically, so I am assuming it is a permissions problem.

Actually i know i have some mistake in my code i really don't know how to change it. But let's see my idea how the logic work.

Dim sb As New StringBuilder

        sb.Append("FirstName, LastName" & vbCrLf)
        sb.Append("Ken, Tucker" & vbCrLf)
        sb.Append("John, Doe" & vbCrLf)

        HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename= test.csv")
        HttpContext.Current.Response.AddHeader("Content-Length", sb.Length.ToString())
        HttpContext.Current.Response.ContentType = "text/csv"

        Dim reqObj As FtpWebRequest = CType(WebRequest.Create("ftp://ftp.xxx.xxx/"), FtpWebRequest)

        reqObj.Method = WebRequestMethods.Ftp.UploadFile
        reqObj.Credentials = New NetworkCredential("xxx", "xxx")
        reqObj.UseBinary = True
        reqObj.UsePassive = True

        Dim streamObj As FileStream = File.OpenRead(HttpContext.Current.ToString)
        Dim buffer(streamObj.Length) As Byte

        streamObj.Read(buffer, 0, buffer.Length)

        streamObj = Nothing

        reqObj.GetRequestStream().Write(buffer, 0, buffer.Length)
        reqObj = Nothing