Overview
Administrators can configure their site to disable browser caching for specific folders or files. This is useful in cases where the files should always be retrieved directly from the server.
Step-by-Step Guide
Use the following procedures to disable the caching of a specified file or folder.
Disable caching for a file
- Access your site's web.config file.
- Add the following elements to the config file, between the <configuration> and </configuration> tags. These elements include a location element that specifies the path to the file for which you are disabling browser caching. In the example below, the file "publication.pdf" from the root folder will not be cached.
<location path="publication.pdf">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
</location> - Upload a new version of the file to that folder and confirm that users are served the new file rather than a cached version.
Disable caching for a folder
- Open your preferred text editor.
- Create a new file with the following text and save it as web.config:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
</configuration> - Move the newly created web.config file to a folder on your DNN site server to disable browser caching for that folder and its contents. For example, placing the file in the Assets folder on your server would prevent browsers from caching any of the files in that folder or its subfolders. If the folder already has a web.config file, edit the existing file to include
<clientCache cacheControlMode="DisableCache" />
within the staticContent element. - Upload new versions of files to that folder and confirm that users are served new files rather than cached versions.
Comments
0 comments
Please sign in to leave a comment.