HttpResponse.AddFileDependencies Method (ArrayList)
Adds a group of file names to the collection of file names on which the current response is dependent.
Assembly: System.Web (in System.Web.dll)
'Declaration Public Sub AddFileDependencies ( _ filenames As ArrayList _ ) 'Usage Dim instance As HttpResponse Dim filenames As ArrayList instance.AddFileDependencies(filenames)
Parameters
- filenames
- Type: System.Collections.ArrayList
The collection of files to add.
The following example is an ASP.NET page that is output cached. The code for the page creates an ArrayList of file paths, and then passes the ArrayList as the parameter in a call to the AddFileDependencies method. This makes the output cached response invalid if any of the files specified in the ArrayList changes.
<%@ Page Language="vb" %> <%@ outputcache duration="30" varybyparam="none" %> <%@ Import Namespace="Samples.AspNet.VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Private Sub Page_Load(sender As Object, e As System.EventArgs) ' Create variable and assign file paths to them. Dim file1 As String = Server.MapPath("authors.xml") Dim file2 As String = Server.MapPath("books.xml") ' Create an array list to contain the file paths. Dim fileList As New ArrayList() fileList.Add(file1) fileList.Add(file2) ' Use the AddFileDependencies method to ' invalidate the output cached page if ' one of the files changes. Response.AddFileDependencies(fileList) ' Populate the DataGrids. dgAuthors.DataSource = DataHelper.GetAuthorData() dgAuthors.DataBind() dgBooks.DataSource = DataHelper.GetBookData() dgBooks.DataBind() lblOutputCacheMsg.Text = DateTime.Now.ToString() End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>PageDataDisplay</title> </head> <body> <form id="Form1" method="post" runat="server"> <table> <tbody> <tr> <th style="WIDTH: 118px"> Authors</th> <td> <asp:DataGrid id="dgAuthors" runat="server"></asp:DataGrid> </td> </tr> <tr> <th style="WIDTH: 118px"> Books</th> <td> <asp:DataGrid id="dgBooks" runat="server"></asp:DataGrid> </td> </tr> <tr> <td style="WIDTH: 118px"> The page was generated at:</td> <td> <asp:Label id="lblOutputCacheMsg" runat="server"></asp:Label> </td> </tr> </tbody> </table> </form> </body> </html>
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.