Suppose that I want my ASP.net web server to open a file and then send it to the browser.
First, I write this:
FileInfo file = new System.IO.FileInfo(@"\\myshare\myfile.zip");
FileStream fileStream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read);
What comes next?
I would think something along the lines of Response.Write(..., but I’m having trouble figuring it out.
A good way to send files is using the content-disposition header before you send the actual raw data
for instance:
where fileName is just the filename (with extension)
and path is the full path to the file