473,799 Members | 3,061 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 1469
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.Expire s = -1
%>

Page 2:

<%
Response.Expire s = -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******** *************@n ews-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.Expire sAbsolute = #2000-01-01#
Response.AddHea der "pragma", "no-cache"
Response.AddHea der "cache-control", pStr
%>

"Captain Nemo" <Ca*****@NoSpam .com> wrote in message
news:DX******** *************@n ews-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*****@dnartr eb.noraa> wrote in message
news:eP******** *****@tk2msftng p13.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
5378
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 would need to use?
10
9504
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 him data. but there is aproblem: all my pages caches before Client and i can not see fresh page.for example if I did some activity on Monday on Wed. i Still see the old page that was produced on Monday.I have put some header in BOth Html And ASP...
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...
0
1542
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 caching. like these... Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache");
8
1955
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 *only* two buttons. They only click a button to start the app. (They have two apps they need to work with) When they minimise the app (and some do this accidently...) the app is NOT visible anymore in a taskbar or so. In fact there is NO taskbar... ...
1
1644
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 to a 4, it still plays the old song. I tried some lines of code to prevent caching, but so far nothing works.
5
2658
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I force a reload from the server/prevent caching? ----------------------------------------------------------------------- To reload a page, use location.reload(). However, this depends upon the cache headers that your server sends. To change this, you need to alter the server configuration. A quick fix on the client is to change the page URI so...
9
6905
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 directory or anywhere else) or we encrypt the images somehow. I'm guessing that encryption will not work, but is there a way to prevent caching? Also, is there a way to prevent printing on a current page? We're already not showing the menu...
3
1726
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 the directory structure of the site that is visible to VS, the next time I perform a build VS takes extra time, apparently downloading the new files (though the time required seems much longer than a one-time download should take). During this...
0
10491
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
10268
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...
1
10247
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10031
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
9079
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
6809
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
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4146
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 we have to send another system
3
2941
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.