Asp.net Web API | Ftp File Upload Sync or Async

  • Thread starter Thread starter ahmedeng89
  • Start date Start date
A

ahmedeng89

Guest
Hello Guys,

I've asp.net web API which upload some specific documents from end users to FTP file location on the server.
the website is public and will have many concurrent users, so many uploads can be invoked .

I want to tell user that the upload is success or fails.


I'm using the following code to upload

FtpWebRequest clsRequest = (FtpWebRequest)System.Net.WebRequest.Create(fileName);
clsRequest.Credentials = new NetworkCredential(ftpUsername, ftpPassword);
clsRequest.Method = Ftp.UploadFile;
using (System.IO.Stream clsStream = clsRequest.GetRequestStream())
{
clsStream.Write(bytes, 0, bytes.Length);
clsStream.Close();
clsStream.Dispose();
}


the code is running but I'm afraid the performance and stability with concurrent users
What's the best way from performance ,stability,and server health with concurrent users and with return success / Failure for each user

Do I need to use Async calls instead and how code should be changed?

Thanks

Continue reading...
 
Back
Top