rockyprince
Programmer
I'm running IIS5.0 on Windows 2000, and have encountered a problem when trying to script changes to the content expiration setting on a sub-directory, within a virtual directory.
Basically, I have a website with an images directory, which I would like to cache for 28 days (only want to chahe the images dir and nothing else).
For this to work, I had to turn on Content Expiration on the top level website, and set it to "Expire Immediately". This is then propigated down the entire website structure.
Then I need to get a handle on the sub-directory and change it's settings.
My problem happens when I try to script a change to the images directory, to change the expiry to 28 days, like this:
Set vDir = GetObject("IIS://LocalHost/w3svc/1/root/images")
vDir.Put "HTTPEXPIRES", "D,2419200"
vDir.SetInfo
This piece of script simply does nothing when I run it.
HOWEVER (and here's the strange bit), if I manually go into IIS, and change the images directory to be a virtual directory, then immediately change it back (ie click CREATE then REMOVE), and run the script, then the changes top the expiry date are implemented.
This seems very strange to me, can anyone shed any light on it?
It seems that I can't script a change to the content expiry section of a sub-directory, unless it was a virtual directory at some stage in it's life.
thanks for any help,
Rory
Basically, I have a website with an images directory, which I would like to cache for 28 days (only want to chahe the images dir and nothing else).
For this to work, I had to turn on Content Expiration on the top level website, and set it to "Expire Immediately". This is then propigated down the entire website structure.
Then I need to get a handle on the sub-directory and change it's settings.
My problem happens when I try to script a change to the images directory, to change the expiry to 28 days, like this:
Set vDir = GetObject("IIS://LocalHost/w3svc/1/root/images")
vDir.Put "HTTPEXPIRES", "D,2419200"
vDir.SetInfo
This piece of script simply does nothing when I run it.
HOWEVER (and here's the strange bit), if I manually go into IIS, and change the images directory to be a virtual directory, then immediately change it back (ie click CREATE then REMOVE), and run the script, then the changes top the expiry date are implemented.
This seems very strange to me, can anyone shed any light on it?
It seems that I can't script a change to the content expiry section of a sub-directory, unless it was a virtual directory at some stage in it's life.
thanks for any help,
Rory