473,498 Members | 359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prevent caching AND have Option Explicit

If you look around on the web for advice on cache-control and using 'Option
Explicit' you get a paradox.

Both features are supposed to be the first piece of ASP code on the page.

Well they can't BOTH be first can they?

OK - I give up. How do you do it?
Jul 19 '05 #1
5 1442
A 20-second experiment with two pages would have yielded an answer faster
than it took you to type up your question.

Page 1:

<%
Option Explicit
Response.Expires = -1
%>

Page 2:

<%
Response.Expires = -1
Option Explicit
%>

I'll leave it, aptly, as an exercise to the reader to figure out which works
correctly, and which yields:

Microsoft VBScript compilation error '800a0400'
Expected statement

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Captain Nemo" <Ca*****@NoSpam.com> wrote in message
news:DX*********************@news-text.cableinet.net...
If you look around on the web for advice on cache-control and using 'Option Explicit' you get a paradox.

Both features are supposed to be the first piece of ASP code on the page.

Well they can't BOTH be first can they?

OK - I give up. How do you do it?

Jul 19 '05 #2
Without seeing the advice to which you're referring, I can only guess that
what the advice was. It was probably that Option Explicit should come first
in the code, and cache control is the first thing you should send to the
browser.

From the example here, http://www.aspfaq.com/show.asp?id=2022, you'd modify
it like so:

<%@ Language = VBScript %>
<%
Option Explicit
Dim pStr

pStr = "private, no-cache, must-revalidate"
Response.ExpiresAbsolute = #2000-01-01#
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", pStr
%>

"Captain Nemo" <Ca*****@NoSpam.com> wrote in message
news:DX*********************@news-text.cableinet.net...
If you look around on the web for advice on cache-control and using
'Option
Explicit' you get a paradox.

Both features are supposed to be the first piece of ASP code on the page.

Well they can't BOTH be first can they?

OK - I give up. How do you do it?

Jul 19 '05 #3
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:eP*************@tk2msftngp13.phx.gbl...
A 20-second experiment with two pages would have yielded an answer faster
than it took you to type up your question.


Sorry, but I'm not an expert ASP programmer. In fact I'm not any kind of
ASP progammer. I'm a PHP programmer who's been saddled with the job of
debugging some idiot's ASP code that doesn't work properly and I have to
start somewhere.

Where I come from, we tend to respond to a straight question with a straight
answer.
Jul 19 '05 #4
> Where I come from, we tend to respond to a straight question with a
straight
answer.


Welcome to somewhere else, I guess. Notice I still provided all of the
information to give you an answer.
Jul 19 '05 #5
Thanks, Ray. That's exactly what I needed to know.
Jul 19 '05 #6

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

Similar topics

14
5343
by: Ludwig77 | last post by:
I read that there are some tags that can be entered in a web page's meta tags in order to prevent web bot searching and indexing of the web page for search engines. What is the tagging that I...
10
9457
by: Behzad | last post by:
Hi all I'am ASP programmer and I have built a site that users can upload and download files.All things store in a DB and everytime someone enters a page,the application requery the Db and shows...
5
3121
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...
0
1528
by: Frankie | last post by:
When I want to prevent a page from being cached, I have been using the following directive: <%@ OutputCache Location="none" %> I have also seen a few other methods recommended to prevent page...
8
1926
by: Arno R | last post by:
Hi all, Is the above possible? I guess I need an API call for this ? How and where to find this? One of my new apps is used as a sort of 'dedicated' thing. Users see an empty desktop with...
1
1632
by: Ronald S. Cook | last post by:
I have an ASPX page wherein I receive an ID of a file to play. http://localhost/fwi/mediaplayer.aspx?id=3 When I go to a browser and type in the above, it works fine. But when I change the 3...
5
2610
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I force a reload from the server/prevent caching?...
9
6882
by: =?Utf-8?B?SmVmZiBCZWVt?= | last post by:
I'm working on a litigation web app where users will review images of case documents. One of the requirements is that we either prevent the images from being cached on the clients machine (in temp...
3
1714
by: Robert Dunlop | last post by:
I am using Microsoft Visual Studio 2005 for development of an ASP.NET site, and I have a problem that greatly effects my workflow at times. It seems that after I upload new files anywhere within...
0
7124
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,...
0
6998
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
7163
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,...
1
6884
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
5460
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,...
1
4904
isladogs
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...
0
4586
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...
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
287
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...

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.