Large file download in asp.net CSharp

There are different methods to download files.
But in different scenario there are different method, I have some research on it.

WriteFile method


This is perfect method to download but if you trying to download large file then it is not a perfect method because it stream a file and load into Server

RAM. That makes a failure if Client is trying to download multiple files from different system. So for Large file it make a server memory problems. If client

from different system trying to download a large file on same time it fails.

TransmitFile method

TransmitFile Method reads Transmit the file into smaller memory buffer .So you don’t have control over the response. You don’t know that download is

completed. If download fails it start download from start. And if  a file is large it will not tell you when the file is downloaded.
If anyone has any good idea pleases post here for knowledge.

How can we Multiple download same  Large file (greater 500mb) from different systems over the internet
Example

protected void DownloadFile(string filename)
   {


       string filepath = Server.MapPath(filename);
       FileStream fStream = null;
       try
       {
           fStream = new FileStream(filepath, FileMode.Open, FileAccess.Read);
           byte[] byteBuffer = new byte[(int)fStream.Length];
           fStream.Read(byteBuffer, 0, (int)fStream.Length);

           fStream.Close();
           Response.Clear();
           Response.ContentType = "application/octet-stream";
           Response.AddHeader("Content-Length", byteBuffer.Length.ToString());
           Response.AddHeader("Content-Disposition", "attachment; filename=" + file_name);
           Response.BinaryWrite(byteBuffer);
           Response.End();
       }
       catch (Exception ee)
       {
           if (fStream != null)
           {
               fStream.Close();
               fStream.Dispose();
           }
       }
   }

 

FIX: You cannot download large files from an ASP.NET application on a computer that is running IIS 6.0

FIX: You may receive an error message when you use a client application to connect to a server that is running IIS 6.0 or when you try to download files from the server

PRB: Response.WriteFile cannot download a large file

You cannot download files that are 2 GB or larger