thi*_*eek 21
protected void DisplayDownloadDialog()
{
    Response.Clear();
    Response.AddHeader(
        "content-disposition", string.Format("attachment; filename={0}", "filename.xml"));
    Response.ContentType = "application/octet-stream";
    Response.WriteFile("FilePath");
    Response.End();
}
这将强制下载文件而不是在浏览器中显示.
这适用于任何文件类型,无需指定任何特殊的MIME类型.
| 归档时间: | 
 | 
| 查看次数: | 8146 次 | 
| 最近记录: |