Serviong user file through filestream
Hi all, for security I am goign to store files outside the website, give the folder asp.net full permission and then stream the file to the user.
Code:
Dim fs As FileStream
Dim strFileName As String = "testdoc.txt"
fs = File.Open(UploadLink & strFileName, FileMode.Open)
Dim bytBytes(fs.Length) As Byte
fs.Read(bytBytes, 0, fs.Length)
fs.Close()
Response.AddHeader("Content-disposition", "attachment; filename=" & strFileName)
Response.ContentType = "application/octet-stream"
Response.BinaryWrite(bytBytes)
Response.End()
I've set up a test page and it works perfectly in IE, FF Opera and Chrome.
My only question is how reliable is this method generally and should I expect some users to encounter issues?
Thanks Dave