Home Dashboard Directory Help
Search

Problem renaming file on FTP server using FtpWebRequest in .NET Framework 4.0 VS2010 only! by atconway


Status: 

Closed
 as Fixed Help for as Fixed


5
0
Sign in
to vote
Type: Bug
ID: 621450
Opened: 11/12/2010 11:06:18 AM
Access Restriction: Public
1
Workaround(s)
view
7
User(s) can reproduce this bug

Description

The simple code to 'rename' a file on a FTP server using the FtpWebRequest class in .NET Framework 4.0 is not preforming as intended. In VS.NET 2010 .NET Framework 4.0 project I always get back when attempting to rename a file on a FTP server: "The remote server returned an error: (550) File unavailable (e.g., file not found, no access)." The identical code when run in VS.NET 2008 .NET Framework 3.5 works perfectly.

The MSDN does not document needing to change how to code using the FtpWebRequest class when issuing a 'WebRequestMethods.Ftp.Rename' method. However looking at a network trace produced using system diagnostics configurations shows that the issuing 'RFNR' FTP command provides the filename preceded with a 'slash' (/) as opposed to solely just the filename. This behavior is causing an unavoidable "The remote server returned an error: (550) File unavailable (e.g., file not found, no access)." error. This is not a permissions issue as I mentioned the code works perfectly in VS.NET 2008.
Details
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:17 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Andrew Burrow on 9/5/2013 at 5:47 AM
Okay thanks for the reply. I'm posting this as it may help someone else in the same situation. I tried the workaround but found it didn't work for me. In the examples I see that most people use RenameTo as a way to move the file also, I was simply renaming the file in it's current location. For me all I had to do was change the way I was setting System.Net.FtpWebRequest.RenameTo by simply ommiting the full path and just specifying newfilename.extension, this worked for me, as apposed to /somefolder/newfilename.extension
Posted by Microsoft on 9/4/2013 at 11:10 AM
The issue was fixed in .NET 4.5. Let us know if you have additional issues here.
Posted by Andrew Burrow on 9/4/2013 at 1:45 AM
Please can someone tell the community when this will be fixed. I also have this issue having upgraded to .Net 4 and now have to code around it.
Posted by Nirav Kanakhara on 3/7/2013 at 3:54 AM
Its not bug, its change in format of input that user has to submit for property ftpwebrequest.RenameTo.
If you can see in vs2008 we are providing the absolute url to rename directory.

while in vs2010 you must have to provide relative url.

i.e. ftpwebrequest.RenameTo = "../" + toFolder + "/" + filename;

Its working...:)
Posted by BushersNeto on 5/17/2011 at 4:06 PM
Is no known workaround for this problem

Spanish

Se conoce alguna solucion alternativo que no sea volver al Framework 3.5

Thanks / Gracias.
Posted by Microsoft on 1/7/2011 at 9:18 AM
We are not currently aware of a workaround. To request a patch for .NET 4.0 please contact support directly (http://support.microsoft.com).
Posted by ryonjensen on 1/6/2011 at 6:14 PM
Looks like this has been resolved ... is there a current work around?
Posted by ocagnato on 12/21/2010 at 7:56 AM
I am facing serious problems about this annoying behavior. When will be resolved?
Posted by steveberkovitz on 12/21/2010 at 7:48 AM
Will this be resolved in SP1?
Posted by Microsoft on 12/13/2010 at 3:46 PM
Thank you for reporting this issue. We will plan to address this in a future release. If you require further assistance please contact support directly (http://support.microsoft.com).
Posted by Microsoft on 11/12/2010 at 11:22 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Jaap K on 6/9/2011 at 5:06 AM
I make use use of a relative path. When logged in into the FTP server, the path of the file, which is used to login, is opened. If I want to replace it, I use a relative path (since .Net Framework 4.0) Before I could use a absolute path.
See for a more detailed description:
http://stackoverflow.com/questions/4159903/problem-renaming-file-on-ftp-server-in-net-framework-4-0-only/5897531#5897531