FtpWebRequest on Reading file just after Uploading give Access denied error

We are using FTPWebRequest class in my project to upload PDF files. For uploading the File we are using Write method by getting a GetRequestStream() from object of (FtpWebRequest)WebRequest.

After uploading files we read the file to get length(size of file). We are using GetResponseStream method of FtpWebResponse for the same.

Everything work fines when files size is less but when heavy files are uploaded then it gives '550' error of access denied.

It seems to me that when big files are being written on FTP and after closing the stream if we immediately go to read the file then it creates problem of access denied may be FTP Server has not removed the lock from file or its still writing the file from stream.

How can be get rid of this problem. Is there is any Event or a Way to find out that File has been successfully written on FTP Server when we are closing the Stream which is being used to Upload file?


Though I don't know why but following steps helped me to solve this problem

  1. Set the buffer size to low on FTP Server, generally it is 64 K you can set it to 32 k

  2. Send the chunks to Server, rather then sending it one go on stream, because when sending it in One go , data is kept in buffer and when we make request to read the file error is prompted.

Need Your Help

mysql GROUP_CONCAT duplicates

sql mysql group-concat

I make my join from a farmTOanimal table like this. There is a similar farmTotool table

jquery dropdown menus changing depending on previous menu values

javascript jquery html

As I am the "tech guy" at the place I work, I have been tasked with creating a submission form for people to log technical issues with our products.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.