M
ManagedCoder
Hi,
My requirement is as follows:
I need to set the HttpExpires (enable content expiration - set to 7 days) on
a folder within a virtual directory.
I have been able to set the HttpExpires property on a virtual directory
using the following code:
DirectoryEntry myVdPath = new
DirectoryEntry("IIS://localhost/W3SVC/1/Root/<virtual directory>");
myVdPath.RefreshCache();
myVdPath.Properties["HttpExpires"].Value = "D, 604800"; //Content expiration
after 7 days
myVdPath.CommitChanges();
But, if I modify the path and use "IIS://localhost/W3SVC/1/Root/<virtual
directory>/<directory on which the property is to be set>", then it throws
the following exception:
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in system.directoryservices.dll
Additional information: The system cannot find the path specified
Regards,
Shailesh Patel
My requirement is as follows:
I need to set the HttpExpires (enable content expiration - set to 7 days) on
a folder within a virtual directory.
I have been able to set the HttpExpires property on a virtual directory
using the following code:
DirectoryEntry myVdPath = new
DirectoryEntry("IIS://localhost/W3SVC/1/Root/<virtual directory>");
myVdPath.RefreshCache();
myVdPath.Properties["HttpExpires"].Value = "D, 604800"; //Content expiration
after 7 days
myVdPath.CommitChanges();
But, if I modify the path and use "IIS://localhost/W3SVC/1/Root/<virtual
directory>/<directory on which the property is to be set>", then it throws
the following exception:
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in system.directoryservices.dll
Additional information: The system cannot find the path specified
Regards,
Shailesh Patel