ASP.NET iframe有时不会更新

时间:2015-07-07 13:43:59

标签: javascript c# jquery asp.net iframe

下面是我简化的.aspx文件。有时在单击“更新预览”按钮后,包含修改后的.pdf文件的iframe会显示最新文件。但有时,在iframe显示最新文件之前需要多次点击。

即使我在新窗口中直接重定向到该文件,.pdf文件仍然不是最新的! (虽然在我服务器的磁盘上)

do()

1 个答案:

答案 0 :(得分:1)

 void download_Click(object sender, EventArgs e)
{
    Response.ContentType = "Application/pdf";
    Response.AppendHeader("Content-Disposition", "attachment; filename=help.pdf");
    Response.TransmitFile(Server.MapPath("~/pdf/catalog.pdf"));
    Response.End();
}

在你的情况下你用301重定向响应给url女巫返回你的文件,问题是你正在使用301重定向,即使你正在更改磁盘文件浏览器也会返回缓存301重定向(同一文件)