我想生成一个pdf文档然后下载
//this is file name
var fileName = name + "_" + DateTime.Now.ToShortDateString() + ".pdf";
//here I generate my pdf document
string fullpath= GeneratePDF();
bool existFile= File.Exists(fullpath);
//here I check if this document exists
if (existFile)
{
HttpContext.Current.Response.ContentType = "Application/pdf";
HttpContext.Current.Response.AppendHeader("Content-Disposition",
"attachment; filename=" + fileName);
HttpContext.Current.Response.TransmitFile(fullpath);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}
遍历所有cod后,文档创建成功,但下载不起作用