Is there a way to set HttpExpires on a sub-directory of a virtual directory programmatically on IIS 6?

0

I have a web application:

W3SVC/1/ROOT/MyApp

I can set the HttpExpires value via adsutil:

cscript C:\InetPub\AdminScripts\adsutil.vbs set W3SVC/1/ROOT/MyApp/HttpExpires "D,86400"

However, I don't want caching for the whole application, just my images which is a subdirectory:

W3SVC/1/ROOT/MyApp/images

Keep in mind that images isn't it's a web directory, just a sub-directory.

When I try thru adsutil I get this:

The path requested could not be found. ErrNumber: -2147024893 (0x80070003) Error Trying To Get the Object: W3SVC/1/ROOT/MyApp/images

windows
wmi
asked on Stack Overflow Dec 20, 2010 by Ken J

1 Answer

0

I was under the impression that creating a web directory would create a virtual directory,but when I look at the metabase it is set as a web directory;so,

Set vDir = GetObject("IIS://LocalHost/w3svc/1/root/myapp")
If err.number <> 0 Then
    Set objRoot = GetObject("IIS://LocalHost/w3svc/1/root/myapp")
    Set vDir = objRoot.Create("IIsWebDirectory", "images")
End If
vDir.Put "HTTPEXPIRES",  "D,2419200"
vDir.SetInfo
answered on Stack Overflow Dec 20, 2010 by Ken J • edited Dec 26, 2012 by onkar

User contributions licensed under CC BY-SA 3.0