
AddFileDependencies | 373
HttpResponse
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
</script>
</head>
<body>
<form runat="server">
<asp:label id="Message" runat="server"/>
<asp:button id="Button1" text="Change Key 1" onClick="Button1_ Click"
runat="server"/>
</form>
</body>
</html>
Notes
The AddCacheItemDependency method provides the same functionality as the
AddCacheItemDependencies method, but for a single cache item rather than
multiple items.
AddFileDependencies
Response.AddFileDependencies(ByVal filenames As ArrayList)
Adds a list of files contained in an ArrayList to the list of files upon which the
output cache of the current request depends. If any of these files is modified, the
output cache is invalidated.
Parameter
filenames
An ArrayList containing one or more path/filenames.
Example
The example shows how you can use the AddFileDependencies method to set a
number of files as dependencies for the output cache of the current response. If
any of these files is modified, the output cache is invalidated.
<%@ Page Language="vb" %>
<%@ OutputCache Duration="300" VaryByParam="None" %>
<html>
<head>
<title>Adding file dependencies in ASP.NET</title>
<script runat="server">
Sub Page_Load( )
Dim myArrayList As New ArrayList
myArrayList.Add(Server.MapPath("dep.txt"))
myArrayList.Add(Server.MapPath("dep1.txt"))
Response.AddFileDependencies(myArrayList) ...