Ask a questionAsk a question
 

Proposed AnswerFtpWebRequest asynchronous Upload

  • Tuesday, October 27, 2009 9:11 PMSumitM Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am uploading file to FTP server asynchronously using the code listed in MSDN.
    http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx

    I give the server credentials, set  the mode and timeout. And in the callback (EndGetStreamCallback) it crashes at
    requestStream = state.Request.EndGetRequestStream(ar);

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

    I looked at the FTP traffic b/w my application and site and observed
    that the connection was a success but
    it had Request: OPT utf8 on
    Response: 550 Permission denied.
    and the PWD (Print Working
    Directory) was "/download/" and my since i gave a path "ftp://
    ftp.xxx.com/upload/filename.txt" it then tries to change the
    directory
    with the command "CWD /download/upload/", since no such directory
    exists remote sever reutrned the error mentioned in the above
    exeption.

    Please advise.

    Thanks
    SM

All Replies