FTP error: (550) File unavailable (e.g., file not found, no access). ???????

Discussion in 'General troubleshooting' started by SkierBob, Dec 2, 2013.

  1. I can transfer this file with FilleZilla but using Vb cannot seem to get it to work -- it errors out on the GetRequestStream() line.
    Any Help??


    Dim DailyDataHistory = GlobalItems.Temp & "DailyDataHistory.csv"
    Dim ftpServer As String = "ftp://bobsplaceon.web802.discountasp.net/WeatherData"


    'set up request...
    Dim clsRequest As System.Net.FtpWebRequest = _
    DirectCast(System.Net.WebRequest.Create(ftpServer), System.Net.FtpWebRequest)


    clsRequest.Credentials = New System.Net.NetworkCredential(user, password)


    clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile


    clsRequest.KeepAlive = False
    clsRequest.UseBinary = True
    clsRequest.UsePassive = True


    ' read in file...
    Dim bFile() As Byte = System.IO.File.ReadAllBytes(DailyDataHistory)


    ' upload file...
    Dim clsStream As System.IO.Stream = clsRequest.GetRequestStream() ?????? Gets to here

    ?????? The remote server returned an error: (550) File unavailable (e.g., file not found, no access). ???????




    clsStream.Write(bFile, 0, bFile.Length)
    clsStream.Close()
     
  2. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    Missing the file extension?
     
  3. Thanks for your reply Ray.
    I do not understand I get the error on the Dim clsStream As System.IO.Stream = clsRequest.GetRequestStream()
    The file to be uploaded is Dim DailyDataHistory = GlobalItems.Temp & "DailyDataHistory.csv" has the file extention.
    What I am I missing?

    Bob
     
  4. FrankC

    FrankC DiscountASP.NET Staff

    mjp likes this.
  5. Thanks for your response
    WeatherData is the folder name the file name
    Dim DailyDataHistory = GlobalItems.Temp & "DailyDataHistory.csv"

    This is the URL that FileZilla returnsftp://0131532|[email protected]802.discountasp.net/WeatherData

    Here is the FileZilla log ----

    Resolving address of ftp.bobsplaceon.web802.discountasp.net

    Status: Connecting to 96.31.33.52:21...

    Status: Connection established, waiting for welcome message...

    Response: 220-Microsoft FTP Service

    Response: 220 DiscountASP.NET FTP

    Command: USER 0131532|bobsplaceon

    Response: 331 Password required

    Command: PASS *********

    Response: 230-Welcome to DiscountASP.NET

    Response: 230 User logged in.

    Command: OPTS UTF8 ON

    Response: 200 OPTS UTF8 command successful - UTF8 encoding now ON.

    Status: Connected

    Status: Starting upload of I:\DailyDataHistory.csv

    Command: CWD /WeatherData

    Response: 250 CWD command successful.

    Command: TYPE I

    Response: 200 Type set to I.

    Command: PASV

    Response: 227 Entering Passive Mode (96,31,33,52,19,229).

    Command: STOR DailyDataHistory.csv

    Response: 125 Data connection already open; Transfer starting.

    Response: 226 Transfer complete.

    Status: File transfer successful, transferred 516,820 bytes in 6 seconds

    Status: Retrieving directory listing...

    Command: PASV

    Response: 227 Entering Passive Mode (96,31,33,52,19,220).

    Command: LIST

    Response: 150 Opening BINARY mode data connection.

    Response: 226 Transfer complete.

    Status: Directory listing successful

    Status: Disconnected from server
     
  6. Some more info.. I changed the Server and Credentials to another of my FTP sites and this exact code works ... what other setting do I need to set?
     
  7. Got the Answer finally!!!
    Had to have the file name in the WebRequest.Create statement! ---

    Dim ftpServer AsString ="ftp://bobsplaceonthelake.com/WeatherData/DailyDataHistory.csv"

    Dim clsRequest As System.Net.FtpWebRequest = _
    DirectCast(System.Net.WebRequest.Create(ftpServer), System.Net.FtpWebRequest)

    Thanks for all your responses
     
    martino, mjp and RayH like this.
  8. FrankC

    FrankC DiscountASP.NET Staff

    glad you resolved the issue.
     
    martino and mjp like this.

Share This Page