FTP, GetResponse (), error 550 File unavailable

the remote server returned an error: (550) file unavailable (e.g., file not found, no access vb net)
ftp error 550
550 the system cannot find the path specified ftp
ftpwebrequest upload file c#
the requested uri is invalid for this ftp command.
the remote server returned an error: (530) not logged in.
upload file to ftp server using asp net c#
upload file to ftp server using c# windows application

I have created a small windows forms application to upload the file to one of our client's ftp site. But the problem that I'm having is that when I run this application on my local machine it uploads the file successfully. But if I run this program on our server, I get this error message;

remote server returned an error: (550) File unavailable (eg, file not found, can not access the file), on this line 'objFTPRequest.GetRequestStream();'.

Does anybody know why? Do I need to configure the firewall or something? Here is my code;

FileInfo objFile = new FileInfo(filename);
FtpWebRequest objFTPRequest;

// Create FtpWebRequest object 
objFTPRequest = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/outbox/" + objFile.Name));

// Set Credintials
objFTPRequest.Credentials = new NetworkCredential(ftpUserName, ftpPassword);

// By default KeepAlive is true, where the control connection is 
// not closed after a command is executed.
objFTPRequest.KeepAlive = false;

// Set the data transfer type.
objFTPRequest.UseBinary = true;

// Set content length
objFTPRequest.ContentLength = objFile.Length;

// Set request method
objFTPRequest.Method = WebRequestMethods.Ftp.UploadFile;

// Set buffer size
int intBufferLength = 16 * 1024;
byte[] objBuffer = new byte[intBufferLength];

// Opens a file to read
FileStream objFileStream = objFile.OpenRead();


// Get Stream of the file
Stream objStream = objFTPRequest.GetRequestStream();

int len = 0;

while ((len = objFileStream.Read(objBuffer, 0, intBufferLength)) != 0)
{
    // Write file Content 
    objStream.Write(objBuffer, 0, len);

}

            objStream.Close();
            objFileStream.Close();

This error can be caused because of several reasons like file is not present on server, security permissions on file etc. etc.

First you need to find out the exact cause of error. This can be achieved by using following code-

try
{
        //Your code
}
catch(WebException e)
{
        String status = ((FtpWebResponse)e.Response).StatusDescription;
}

Once you get the exact cause of error, you can go forward to solve it.

Here are some links you can refer

http://forums.asp.net/t/1777881.aspx/1

http://nickstips.wordpress.com/2010/10/25/c-ftp-upload-error-the-remote-server-returned-an-error-550-file-unavailable-e-g-file-not-found-no-access/

http://www.dreamincode.net/forums/topic/76361-file-upload-to-server/

http://forums.asp.net/t/1374306.aspx/1

The remote server returned an error: (550) File unavailable(Error , I was setting up my own IIS 7 FTP server and spent a good hour or two trying to GetResponse() as FtpWebResponse; } catch ( Exception ex )  I think your FTP server name should be Dim ftpServer As String = "ftp://bobsplaceon.web802.discountasp.net"When you upload, you should use /WeatherData/filename

Try this: ftp://xxx.xxx.xx.xx:21//path/filename

The "//" after the server address starts you out at the root directory. Even though I had: ftp://xxx.xxx.xx.xx:21/path/filename, it didn't take me to the correct directory.

the remote server returned an error (550) file unavailable (e.g. file , You either don't have access to the files at the folder/path you gave the FtpClient or the files don't exist. You'll have to double-check the filepath  I'm searched and found other questions on this but none have solved my issues. I'm trying to upload a file via FTP using sample MSDN code. I get the The remote server returned an error: (550) File

I met the same problem, and this is what I did:

  1. Check the OS has the right to write. Find the ftp folder =>right click=>properties=>security, then you must know what you should do
  2. Check the ftp server open the write right to the user you logged. Open IIS=>click the ftp site=>ftp Authorization Rules=>add allow rules=>choose a user or group to set the rights
  3. Check the the dir on the ftp server, do the same thing on item 2.

I can use four pictures to show the rights to be set:

The remote server returned an error (550) file unavailable, 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?? The remote server returned an error: (550) File unavailable What could be the cause of this? I'm running an FTP Server using Golder FTP Server, which is freeware.

It could be more simple.

I facing similar issue and i tried all the suggested solution but no one work. I'm figure out in simple manner like this one : take a look

Wrong code at my end

 Dim request As Net.FtpWebRequest = CType(FtpWebRequest.Create("ftp://xxx.xxx.xxx.xxx/files"), FtpWebRequest)

Change it in this simple one :

 Dim request As Net.FtpWebRequest = CType(FtpWebRequest.Create("ftp://xxx.xxx.xxx.xxx/files/youfilename.ext"), FtpWebRequest)

then procced with fill request and send to server :)

That's all.

Make sure that all permission on server work fine and u're using right credential.

FTP error: (550) File unavailable (e.g., file not found, no access , I have the FTP Upload module that do the upload files from the client side to the FTP, but it complains at this GetRequestStream() , and gives me an error message "The remote server returned an error: (550) File unavailable (e.g., file not found, no access). GetResponse(), FtpWebResponse)Console. "The remote server returned an error: (550) File unavailable (e.g., file not found, no access). I have logged into that same directory using FileZilla and can successfully upload the file so my user login has the rights.

In order to resolve this issue, it is required to force the System.Net.FtpWebRequest command to revert back to the old behavior of how it used to work in .Net Framework 2.0/3.5 and issue the extra CWD command before issuing the actual command.

In order to do this, the following code needs to be placed before any instance of the System.Net.FtpWebRequest class is invoked. The code below only needs to be called once, since it changes the settings of the entire application domain.

private static void SetMethodRequiresCWD()
{
        Type requestType = typeof(FtpWebRequest);
        FieldInfo methodInfoField = requestType.GetField("m_MethodInfo", BindingFlags.NonPublic | BindingFlags.Instance);
        Type methodInfoType = methodInfoField.FieldType;


        FieldInfo knownMethodsField = methodInfoType.GetField("KnownMethodInfo", BindingFlags.Static | BindingFlags.NonPublic);
        Array knownMethodsArray = (Array)knownMethodsField.GetValue(null);

        FieldInfo flagsField = methodInfoType.GetField("Flags", BindingFlags.NonPublic | BindingFlags.Instance);

        int MustChangeWorkingDirectoryToPath = 0x100;
        foreach (object knownMethod in knownMethodsArray)
        {
            int flags = (int)flagsField.GetValue(knownMethod);
            flags |= MustChangeWorkingDirectoryToPath;
            flagsField.SetValue(knownMethod, flags);
        }
 }

http://support.microsoft.com/kb/2134299

550 file unavailable error trying to upload a file with FtpWebRequest , FtpWebRequest can throw an exception if FtpWebResponse. server returned an error: (550) File unavailable (e.g., file not found, no access). we need to ensure that GetResponse() will not return until all data is drained. Check the OS has the right to write. Find the ftp folder =>right click=>properties=>security, then you must know what you should do. Check the ftp server open the write right to the user you logged. Open IIS=>click the ftp site=>ftp Authorization Rules=>add allow rules=>choose a user or group to set the rights.

The remote server returned an error: (550) File unavailable (e.g., file , FTP, GetResponse (), error 550 File unavailable. Question. I have created a small windows forms application to upload the file to one of our client's ftp site. Dave, As discussed and tested during our conversation that lasts over the last week , the script has to look like below: @echo off rem build the ftp command file to get the list of files to be transfered echo open ftp_server_name>fisierftp.txt echo user username password_of_username>>fisierftp.txt echo cd directory_name_if_any >>fisierftp.txt echo ls *.xml resp.txt >>fisierftp.txt echo bye

FtpWebRequest can throw an exception if FtpWebResponse.Close , I get the above error when trying to upload a file to a valid server remote server returned an error: (550) File unavailable (e.g., file not found, n Private Function ExecuteFTPRequest() As Exception GetResponse, System. The remote server returned an error: (550) File unavailable (e.g., file not found, no access) in c# .net windows application during .txt file download When i using download file from ftp so its getting error:-My zip file successfully downloading but my .txt file not downloading. Please help me. Two file in a folder on server ftp:-

FTP, GetResponse (), error 550 File unavailable,

Comments
  • Hi again. Thanks. The actual error message is 550 Access denied. I have given my folder full permission except 'Special permission'. Is there another possible cause besides 'special permission' ?
  • Hi guys. I didn't win. I decided to host this app on another machine. It works fine. Thanks.
  • This error may occur if you dont have enough permission or the directory in request is not present. like files in xxx.xxx.xxx.xxx/files
  • What a helpful tip, I was catching the "Exception" event only, now I can clearly see what the error stands for! Thanks
  • This is so horrible but it actually worked for me - I'm appalled, and I suppose that should be a bug, but thanks.
  • Amazing! That actually solved the problem. Thank god you wrote that. Would have never guessed it in a million years.
  • Also ran into the problem. Great tip, never would have tried that.
  • This is got to be a bug in the MS FTP executable. I saw consistent, random failures of longer file paths pushing to an IIS FTP endpoint. The above fixed them.
  • Hi francis. I will try your suggestion. I will let you know as soon as i come right. Thank you
  • Remember to set the permissions on child folders. You can set the permissions on the top most folder and inherit these permissions down to child folders by: go to top level ftp folder =>right click=>properties=>security => advanced => pick a user => change permissions => edit permissions (as required) AND "include inheritable permissions from the object's parent"
  • Well spotted! I had this problem myself and had a look at the links provided here but they didn't help. Anyhow, the reason for the comment is because the official Microsoft documentation is incorrect. I followed this example: msdn.microsoft.com/en-us/library/ms229715(v=vs.110).aspx The request address is suffixed with a ".htm" extension and a text file is uploaded. I just thought the page was an error rather than the extension type. Beware anyone else that follows the above Microsoft example! Regards, Matt