There are different methods to download files.
But in different scenario there are different method, I have some research on it.
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 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
protected void DownloadFile(string filename)
string filepath = Server.MapPath(filename);
FileStream fStream = null;
fStream = new FileStream(filepath, FileMode.Open, FileAccess.Read);
byte byteBuffer = new byte[(int)fStream.Length];
fStream.Read(byteBuffer, 0, (int)fStream.Length);
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + file_name);
catch (Exception ee)
if (fStream != null)
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