K
K Viltersten
I'm uploading a file to a FTP-server and after
the download, which is successful, since i see
the file as it's supposed to be, i'd like to
check on the response left by the server.
The problem is that when i execute
upload.GetResponse();
i'm getting an error message about saying that
the connection is in use and that i can't
perform a new call.
I have no clue on how to approach it. Please
suggest what might be wrong here.
FtpWebRequest upload =
(FtpWebRequest) WebRequest.Create( uri );
upload.Method = WebRequestMethods.Ftp.UploadFile;
upload.UseBinary = true;
FileStream fs = new FileStream( local, FileMode.Open );
BinaryReader reader = new BinaryReader( fs );
byte[] dataRead = new byte[fileInfo.Length];
reader.Read( dataRead, 0, dataRead.Length );
reader.Close();
fileStream.Close();
Stream stream = upload.GetRequestStream();
foreach (byte b in dataRead)
stream.WriteByte( b );
FtpWebResponse response =
(FtpWebResponse) upload.GetResponse();
if (response.StatusDescription.StartsWith( "226" )) {}
the download, which is successful, since i see
the file as it's supposed to be, i'd like to
check on the response left by the server.
The problem is that when i execute
upload.GetResponse();
i'm getting an error message about saying that
the connection is in use and that i can't
perform a new call.
I have no clue on how to approach it. Please
suggest what might be wrong here.
FtpWebRequest upload =
(FtpWebRequest) WebRequest.Create( uri );
upload.Method = WebRequestMethods.Ftp.UploadFile;
upload.UseBinary = true;
FileStream fs = new FileStream( local, FileMode.Open );
BinaryReader reader = new BinaryReader( fs );
byte[] dataRead = new byte[fileInfo.Length];
reader.Read( dataRead, 0, dataRead.Length );
reader.Close();
fileStream.Close();
Stream stream = upload.GetRequestStream();
foreach (byte b in dataRead)
stream.WriteByte( b );
FtpWebResponse response =
(FtpWebResponse) upload.GetResponse();
if (response.StatusDescription.StartsWith( "226" )) {}