private void Page_Load(object sender, System.EventArgs e)
{
string path = Server.MapPath(Request.Params["File"]);
System.IO.FileInfo file = new System.IO.FileInfo(path);
//clear the current output content from the buffer
Response.Clear();
//add the header that specifies filename for the download/saveas dialog
Response.AddHeader("Content-Disposition","attachment; filename=" + file.Name);
//add header that specifies size so the browser will show a progress bar
Response.AddHeader("Content-Length", file.Length.ToString());
//Set contenttype so client knows to only download file
Response.ContentType="application/octet-stream";
//send the file
Response.WriteFile(file.FullName);
Response.End();
}
Print | posted on Saturday, July 10, 2004 11:25 AM