You can also set this directly on a folder using the metabase:
Here's how you would set the folder pix on the default website:
Open a command prompt and change to your C:\InetPub\AdminScripts folder.
Run the following command:
CSCRIPT ADSUTIL.VBS SET W3SVC/1/ROOT/pix/CacheControlCustom "no-cache"
Note the possible values are "no-cache" , "Public", "Private"
Yo can also set this via ADSI:
Option Explicit
Dim objCache
Set objCache = GetObject("IIS://localhost/w3svc/1/root/pix")
objCache.CacheControlCustom = "no-cache"
objCache.SetInfo
So far these approaches will work on IIS6 and IIS7 so long as you have the IIS6 admin tools installed. For a pure IIS7 environment here are the appcmd commands:
First unlock the config section
appcmd unlock config /section:staticContent
Now you're good to change the caching options for static content.
Make static content non-cacheable by setting "Cache-Control: no-cache":
appcmd set config "Default Web Site/<Application>/<Folder>" /section:staticContent /clientCache.cacheControlMode:DisableCache
Where <Application>/<Folder> is the path to your folder
I don't think the IIS web server is the one caching pages - it's the client's browser.
You can add a meta tag to the pages you don't want the client side to cache, and there are ways to do this for different older browsers and such.
If you write in ASP and want the same non-cache effect, here's the header information.
The thing you are looking for is cache-control header value (note that this only works for browsers that respect http 1.1)
For asp the code is:
You can also set this directly on a folder using the metabase:
Here's how you would set the folder pix on the default website: Open a command prompt and change to your C:\InetPub\AdminScripts folder. Run the following command: CSCRIPT ADSUTIL.VBS SET W3SVC/1/ROOT/pix/CacheControlCustom "no-cache"
Note the possible values are "no-cache" , "Public", "Private"
Yo can also set this via ADSI:
So far these approaches will work on IIS6 and IIS7 so long as you have the IIS6 admin tools installed. For a pure IIS7 environment here are the appcmd commands:
First unlock the config section
Now you're good to change the caching options for static content. Make static content non-cacheable by setting "Cache-Control: no-cache":
Where
<Application>/<Folder>
is the path to your folderSee also IIS 7.0: clientCache Element for staticContent (IIS Settings Schema)