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. 2 8179
On Tue, 19 Jul 2005 10:01:10 -0500, lanem
<la***@discussions.microsoft.com> wrote: 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.
The easiest way to avoid caching is to not link to the pdf file directly,
but create an aspx file that 'serves' the file to the user. Then you can
set headers, etc. appropriately to keep it out cache, or add a unique
querystring argument to the .aspx URL when you call it....
An example of streaming: http://www.ondotnet.com/pub/a/dotnet...04/01/asp.html
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Thanks. That worked great. I can get it to work now using the streaming
stuff. I also figured out my previous problem, caching of the pdf pages. I
fixed this by putting a response.expires = -1 in my HTTP Module. So now,
both methods work. Which do you think is better and more secure? Using an
HTTP module or using this streaming solution? Thanks.
"Craig Deelsnyder" wrote: On Tue, 19 Jul 2005 10:01:10 -0500, lanem <la***@discussions.microsoft.com> wrote:
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.
The easiest way to avoid caching is to not link to the pdf file directly, but create an aspx file that 'serves' the file to the user. Then you can set headers, etc. appropriately to keep it out cache, or add a unique querystring argument to the .aspx URL when you call it....
An example of streaming: http://www.ondotnet.com/pub/a/dotnet...04/01/asp.html
-- Craig Deelsnyder Microsoft MVP - ASP/ASP.NET This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Larry Neylon |
last post by:
Hi,
I am having problems with our IIS6 server serving out of date javascript
files in our ASP scripts.
It appears to be an intermittent problem, but causes all kinds of headaches
when working...
|
by: Nick Gilbert |
last post by:
Hi,
Our development web server (Win 2003 Server) seems to be caching the
output of various files (CSS and .aspx files) if they have no query
string. The moment you put a question mark in the...
|
by: Vjay77 |
last post by:
I have a timer which triggers AxWebBrowser1 every 5 minutes to visit
one of my websites.
What I find out later in my websites logs, was, that it really visited
my website only for the first...
|
by: Steve Mauldin |
last post by:
I have three websites that were developed by using the same code in .net.
They are all located under wwwroot on my desktop running windows 2000
pro.because Windows 2000 pro only supports a single...
|
by: Alex Greenberg |
last post by:
Hi,
I'm having a strange problem:
I have a product.aspx page where the admin can change product
properties, including the JPEG. The JPEG will always have the same
name: eg. 120.jpg and in...
|
by: docsearch |
last post by:
Hi all,
I've made a "LAMP docs" search website and want to collect PHP-related
docs as much as possible. It now covers PHP, Apache, MySQL and Smarty.
I'm looking for usefull online documentaion...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |