MAW74656
MAW74656

Reputation: 3539

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. My problem now is that this seems to cache the PDF files locally. 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.

How can I prevent these files from caching in code (or do I have to do from IIS or the shared folder)?

Upvotes: 2

Views: 2128

Answers (1)

Pankaj
Pankaj

Reputation: 10105

Did you try with below code.

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

Upvotes: 1

Related Questions