1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
/// <summary>
/// Starts the download.
/// </summary>
/// <param name="path">The path.</param>
private static void StartDownload(string path)
{
FileInfo downloadFile = new FileInfo(path);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", downloadFile.Name));
HttpContext.Current.Response.AddHeader("Content-Length", downloadFile.Length.ToString());
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.WriteFile(downloadFile.FullName);
HttpContext.Current.Response.End();
}
|