473,396 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to stop PDF from caching on the browser from asp.net code?

I am working on a ASP.NET 2.0 web site that has some PDFs that users can
download. I'm using an HTTP module to see if the user has permission to view
the PDF before loading it. This all works great. The problem is that once
the PDF has been allowed through to the browser, it won't be denied to the
next user. So, if one user is allowed to see it and then a user who is not
allowed to see it uses the same browser, it comes through for them. If I
clear the cache on the browser, it works again. I think that once the PDF
doc comes through, the browser is caching it. How can I prevent this caching
from my web code? Thanks.

Nov 19 '05 #1
3 1940
you will have to change the expiration header for the browser and any
proxies. see w3c http 1.1 spec for header info.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

-- bruce (sqlwork.com)


"lanem" <la***@discussions.microsoft.com> wrote in message
news:AC**********************************@microsof t.com...
I am working on a ASP.NET 2.0 web site that has some PDFs that users can
download. I'm using an HTTP module to see if the user has permission to
view
the PDF before loading it. This all works great. The problem is that
once
the PDF has been allowed through to the browser, it won't be denied to the
next user. So, if one user is allowed to see it and then a user who is
not
allowed to see it uses the same browser, it comes through for them. If I
clear the cache on the browser, it works again. I think that once the PDF
doc comes through, the browser is caching it. How can I prevent this
caching
from my web code? Thanks.

Nov 19 '05 #2
Is that true for PDFs?

"Bruce Barker" wrote:
you will have to change the expiration header for the browser and any
proxies. see w3c http 1.1 spec for header info.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

-- bruce (sqlwork.com)


"lanem" <la***@discussions.microsoft.com> wrote in message
news:AC**********************************@microsof t.com...
I am working on a ASP.NET 2.0 web site that has some PDFs that users can
download. I'm using an HTTP module to see if the user has permission to
view
the PDF before loading it. This all works great. The problem is that
once
the PDF has been allowed through to the browser, it won't be denied to the
next user. So, if one user is allowed to see it and then a user who is
not
allowed to see it uses the same browser, it comes through for them. If I
clear the cache on the browser, it works again. I think that once the PDF
doc comes through, the browser is caching it. How can I prevent this
caching
from my web code? Thanks.


Nov 19 '05 #3
In the Properties of the web site in IIS you will find "Content Expiration".
Set it to something like one minute. Setting it to "expire immediately" may
cause problems with the Adobe Reader when the user views it.

"lanem" wrote:
Is that true for PDFs?

"Bruce Barker" wrote:
you will have to change the expiration header for the browser and any
proxies. see w3c http 1.1 spec for header info.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

-- bruce (sqlwork.com)


"lanem" <la***@discussions.microsoft.com> wrote in message
news:AC**********************************@microsof t.com...
I am working on a ASP.NET 2.0 web site that has some PDFs that users can
download. I'm using an HTTP module to see if the user has permission to
view
the PDF before loading it. This all works great. The problem is that
once
the PDF has been allowed through to the browser, it won't be denied to the
next user. So, if one user is allowed to see it and then a user who is
not
allowed to see it uses the same browser, it comes through for them. If I
clear the cache on the browser, it works again. I think that once the PDF
doc comes through, the browser is caching it. How can I prevent this
caching
from my web code? Thanks.


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dave Griffiths | last post by:
Hi all Very new to JavaScript, I am trying to cache a number of images as the page loads, is there a max number of images or memory usage before the browser stops caching. My PC has 1G ram so...
6
by: ZagrebMike | last post by:
On our (intranet) web site we have an ASP page that runs a report which serves up the results in a dynamic Excel file (i.e it specifies Response.ContentType = "application/vnd.ms-excel"). This...
5
by: R. Ian Lee | last post by:
I have an ASP.NET page that spawns a popup window using javascript's window.open. This works fine. It pops up, you enter some data, press save and everything saves as it should. But, if you...
4
by: Captain Chaos | last post by:
Is it Possible to Cache Pictures JPG/BMP on the Client Browser ? The other Elements of the Page should not being cached because they change. Is it possible to cache parts of a page on the...
2
by: lanem | last post by:
I am working on a ASP.NET 2.0 web site that has some PDFs that users can download. I'm using an HTTP module to see if the user has permission to view the PDF before loading it. This all works...
14
by: rolfejr | last post by:
I am trying to display a PDF in the users browser that is pulled from a binary field in our database, and keep that PDF from caching on the client computer. I can successfully pull the PDF and...
2
by: mark4asp | last post by:
Can I force the client to stop caching old stylesheets and javascript? In my dynamic web-site, I need to force the client to stop caching old versions of my stylesheets and javascript. Can I do...
1
by: mwk24 | last post by:
Hi all, I have standard AJAX script that calls a php file to load the latest information and uses xmlHTTP.responseText to write it to innerHTML of a div by id. It works fine on IE/firefox, but I'm...
3
by: =?Utf-8?B?cHJhZGVlcF9UUA==?= | last post by:
Hi All, Can anyone please explain me why I am not able to disable Browser caching in ASP.net by writing the following code Response.Buffer = true; Response.ExpiresAbsolute =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.