I have just upgraded an application from net 3.5 to 4.0
I read and transfer files using ftp. An everything is great except for one of the servers I connect to. That server is strange to begin with as I have to go back one directory and down into another:
“ftp.server.com” actually puts me in http://ftp.server.com/up, and I need to read from http://ftp.server.com/out
I get a filelist using this url:
ftp://ftp.server.com/%2fout
Web request is created this way:
var request = (FtpWebRequest) WebRequest.Create("ftp://ftp.server.com/%2fout");
I get the filelist – no problem, so that method works for connecting to the directory, but when trying to read one of the files i now get an error.
I create that request this way:
var request = (FtpWebRequest)WebRequest.Create("ftp://ftp.server.com/%2fout/" + filename);
I have logged the URI of the request to be:
ftp://ftp.server.com//out/ORDER25260.xml_XL1014254ORDER25260_response.xml
I get this stacktrace:
The remote server returned an error: (550) File unavailable (e.g., file not found, no access). at System.Net.FtpWebRequest.CheckError()
at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
at System.IO.Stream.Close()
at System.Net.ConnectionPool.Destroy(PooledStream pooledStream)
at System.Net.ConnectionPool.PutConnection(PooledStream pooledStream, Object owningObject, Int32 creationTimeout, Boolean canReuse)
at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)
at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
at System.Net.CommandStream.Abort(Exception e)
at System.Net.CommandStream.CheckContinuePipeline()
at System.Net.FtpDataStream.System.Net.ICloseEx.CloseEx(CloseExState closeState)
at System.Net.FtpDataStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at CustomModules.CustomModules.SupplierFunctions.FtpMethods.GetFile(SynsamSupplierSetting setting, String filename, Boolean deleteAfterLoad) in D:\WORK\dynamicweb\Source\CustomModules\SupplierFunctions\FtpMethods.cs:line 295
I have noproblem downloading via FileZilla using same credentials
Any idea?
Thanks in advance
Resolved this using information on this thread:
550 file unavailable error with FtpWebRequest class file upload. Works fine in FileZilla
User SteveCalPoly writes:
The question relates to uploads, so I missed it in my first google for answers