is it good way for download ?
The Weird and The Wonderful
2
Posts
2
Posters
10
Views
1
Watching
-
(DOWNLOAD Book)link where would u make it. DOWNLOAD Book
a href="dnload.aspx?filebook=../pdf/book.pdf
dnload.aspx// download page load event string strRequest = Request.QueryString["filebook"]; if (strRequest != "") { string path = Server.MapPath(strRequest); System.IO.FileInfo file = new System.IO.FileInfo(path); if (file.Exists == true) { Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + filebook.Name); Response.AddHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(filebook.FullName); Response.End(); } else { Response.Write("This file does not exist."); } } else { Response.Write("Please provide a file to download."); }
Pavan Pareta
-
(DOWNLOAD Book)link where would u make it. DOWNLOAD Book
a href="dnload.aspx?filebook=../pdf/book.pdf
dnload.aspx// download page load event string strRequest = Request.QueryString["filebook"]; if (strRequest != "") { string path = Server.MapPath(strRequest); System.IO.FileInfo file = new System.IO.FileInfo(path); if (file.Exists == true) { Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + filebook.Name); Response.AddHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(filebook.FullName); Response.End(); } else { Response.Write("This file does not exist."); } } else { Response.Write("Please provide a file to download."); }
Pavan Pareta
It does not sound logical. One can just entrap querystring and then manually build the path, defeat the download statistics routine or an optional logon check. You should pass some ID and read the file on serverside and stream it. The file should be away from virtual folder.
Vasudevan Deepak Kumar Personal Homepage Tech Gossips