This documentation is archived and is not being maintained.

HttpResponse.AddFileDependencies Method (ArrayList)

Adds a group of file names to the collection of file names on which the current response is dependent.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)

public void AddFileDependencies(
	ArrayList 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="c#" %>
<%@ outputcache duration="30" varybyparam="none" %>
<%@ Import Namespace="Samples.AspNet.CS" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<script runat="server">

    private void Page_Load(object sender, System.EventArgs e) 

        // Create variables and assign file paths to them.
        string file1 = Server.MapPath("authors.xml");
        string file2 = Server.MapPath("books.xml");

        // Create an array list to contain the file paths.
        ArrayList fileList = new ArrayList();

        // Make the page dependent upon the arrayList.

        // Populate the DataGrids.
        dgAuthors.DataSource = DataHelper.GetAuthorData();

        dgBooks.DataSource = DataHelper.GetBookData();

        lblOutputCacheMsg.Text = DateTime.Now.ToString();


<html xmlns="" >
    <form id="Form1" method="post" runat="server">
          <th style="WIDTH: 118px">
            <asp:DataGrid id="dgAuthors" runat="server"></asp:DataGrid>
          <th style="WIDTH: 118px">
            <asp:DataGrid id="dgBooks" runat="server"></asp:DataGrid>
          <td style="WIDTH: 118px">
            The page was generated at:
            <asp:Label id="lblOutputCacheMsg" runat="server"></asp:Label>

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.