【问题标题】:Preventing caching of server side include files防止缓存服务器端包含文件
【发布时间】:2012-02-22 15:14:23
【问题描述】:

我有一个经典的 ASP 页面,它使用服务器端包含调用其他一些 ASP 文件。

我不希望任何浏览器缓存主文件和包含的文件。

目前我的主要看起来像这样:

<%@ 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>

我只将 Response.CacheControl、Response.AddHeader、Response.Expires 代码放在主页上,而不是放在包含的文件上。

我的问题是:

  1. 是否所有服务器端包含的 ASP 页面都需要我使用过的 Response.CacheControlResponse.AddHeaderResponse.Expires 代码,还是只需要主文件?

  2. 我使用的代码是否足以阻止所有浏览器上的缓存?

【问题讨论】:

    标签: caching asp-classic ssi


    【解决方案1】:

    如您所示,只有“主”输出页面需要标题。服务器端包含发生在服务器内部,因此浏览器永远不会看到它。

    你做得对。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-09
      • 2017-02-06
      • 1970-01-01
      相关资源
      最近更新 更多