473,804 Members | 3,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1953
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***@discussi ons.microsoft.c om> wrote in message
news:AC******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
news:AC******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
news:AC******** *************** ***********@mic rosoft.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
7197
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 if it's a physical memory constraint then I think I am away from that. I am trying to cache about 600K images, (this if for an intranet so the page load time is fast) but I need the speed of cached images for the page to work correctly. I seem to...
6
1831
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 works fine for most people. One user is having a problem, though: she generates the report once, and it works fine. If she changes the parameters and runs the report again, it displays the original result. She says it "used to" work OK. ...
5
3139
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 click the button to open the popup again, then it opens with the values that were in it before the "save" was executed. I've determined that the problem is that IE is storing the page in it's local temporary internet files cache and isn't going to...
4
1389
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 Client but not the whole page
2
8232
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 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...
14
11905
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 display it using the following code: Response.ContentType = "application/pdf" Response.BinaryWrite objRS("Attachment") where objRS("Attachment") is a reference to the binary field retrieved from the database. However, I have tried adding...
2
4308
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 this by including a querystring with the url with each external stylesheet and script file declaration? For example: <link type="text/css" rel="stylesheet" href="../images/menu.css?
1
2756
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 having trouble with Opera Mobile, due to javascript caching (at least that is my suspicion) I installed Opera for Windows and had the same problem (described below), until I set the Other Modification setting to 0 in opera.ini (i.e. to set Opera to...
3
2512
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 = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0)); Response.Expires = 0; Response.CacheControl = "no-cache";
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10571
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10326
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.