我的代码是这样的
public static void Deleter()
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + "name" + ".pdf");
HttpContext.Current.Response.TransmitFile("~/media/pdf/" + "name" + ".pdf");
if (FileExists("/media/pdf/" + "name" + ".pdf"))
{
System.IO.File.Delete("D:/Projects/09-05-2013/httpdocs/media/pdf" + "name" + ".pdf");
}
HttpContext.Current.Response.End();
}
执行完整个代码后,我仍然可以在文件夹中看到 name.pdf。没有抛出错误。谁能告诉我出了什么问题?