开发者

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

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 m开发者_运维问答ind 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


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜