2

I have a classic ASP page that calls in some other ASP files using Server Side Includes.

I want neither the main file nor the included files to be cached by any browser.

At the moment my main looks something like this:

<%@ Language="VBSCRIPT" %><% Option Explicit %>
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires=-1
%> 
<!--#include file="scripts1.asp"-->
<!--#include file="scripts2.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>myTitle</title>
<!--#include file="head.asp"-->
</head>
<body>
<!--#include file="body.asp"-->
</body>
</html>

I have only placed the Response.CacheControl, Response.AddHeader, Response.Expires code on the main page and not on the included files.

My questions are:

  1. Do all server side included ASP pages need the Response.CacheControl, Response.AddHeader and Response.Expires code that I have used, or just the main file?

  2. Is the code I have used sufficient to prevent caching on all browsers?

Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
David
  • 1,005
  • 1
  • 10
  • 12

1 Answers1

4

Only the "master" output page needs the headers, as you've shown. The server-side include happens internally on the server, so the browser never sees it.

You're doing it right.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176