HttpResponse.AddFileDependency(String) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a single file name to the collection of file names on which the current response is dependent.
public:
void AddFileDependency(System::String ^ filename);
public void AddFileDependency(string filename);
member this.AddFileDependency : string -> unit
Public Sub AddFileDependency (filename As String)
- filename
- String
The name of the file to add.
The following example shows how to add a single file name to the AddFileDependency file dependency list. If the file changes, the cached response is invalidated.
String FileName;
FileName = "C:\\Files\\F1.txt";
Response.AddFileDependency(FileName);
Dim FileName As String
FileName = "C:\Files\F1.txt"
Response.AddFileDependency(FileName)
When you use the AddFileDependency method to add a file dependency, you must also specify output caching programmatically or declaratively. For example, to specify output caching declaratively, use the @ OutputCache directive. For more information, see How to: Cache Page Output with File Dependencies.
Product | Versions |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: