简体   繁体   English

如何防止本地缓存PDF?

[英]how to prevent caching PDF's locally?

I have an asp.net webform that displays a PDF, Stack helped me with that How to display a pdf file in asp.net web-form . 我有一个显示PDF的asp.net网络表单,Stack帮助我解决了如何在asp.net网络表单中显示pdf文件 My problem now is that this seems to cache the PDF files locally. 我现在的问题是,这似乎在本地缓存PDF文件。 I need them to be freshly retrieved from the server each time they're called to account for updates. 每次调用它们来说明更新时,我都需要从服务器中重新获取它们。

The PDF files are stored in a network shared folder. PDF文件存储在网络共享文件夹中。

How can I prevent these files from caching in code (or do I have to do from IIS or the shared folder)? 如何防止这些文件缓存在代码中(或者必须从IIS或共享文件夹执行)?

Did you try with below code. 您是否尝试过以下代码。

protected void Page_Load(object sender, EventArgs e)
{
    Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM