.net - Securing Large Downloads Using C# and IIS 7 -


Here's the setup:

  • 1 web server to which the C # app runs

  • 1 TBD software running the file server in the past I used to save files on the file server to lighttpd and Mod_secdownload is used, and it worked well (IIS).

The method of doing this using a combination of IIS and C # Net all my other servers are running that combo, and if I can do this for the file server, then it will make things easier, the files that are being hosted are big, I have to make a file app Examples of people using a small app, have read in the file, and manually create HTP responses. It works, but since I'm working with files of 500+ MB size, this is slow as a hack. And I have potentially 300 users who hit the box at a time, request the files. It is not good.

So, can anyone see a way around this? I am trying to create another transparent system, and if all my servers are running the same software / hardware, then it will make my life much easier thanks to any advice given by you!

What do you know? KB article is my official recommendation here:

  Public Zero Streamfile (string file path) {string fileName = Path. GetFileName (filePath); (Var fstream = new file stream (file path, filemod. Open, file access readread, fileshare.read)) {var contentLength = fStream.Length; If (Request.UserAgent.Contains ("MSIE")) {Response.AddHeader ("Content-Transfer-Encoding", "Binary"); } Response.ContentType = "application / octet-stream"; Response.AddHeader ("content-length", contentLength.ToString ()); According to // http://www.ietf.org/rfc/rfc2183.txt //, the upper-case "D" should be "D" in "content-disposing", although IE fails to recognize it if "D" The upper is -cased. Response.AddHeader ("content-type", "attachment; file name =" + filename); Var buffer = new byte [8192]; While (Response. ISL Connected) {var count = fstream.Read (buffer, 0, buffer lang); If (calculation == 0) {break; } Response.OutputStream.Write (buffer, 0, count); Response.Flush (); }} Response. Stop it (); }  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -