function CreateVirtualDir(VirtualName,VirtualDataPath)
STRING szWaitTxt,szVirPath;
OBJECT objIIS_Virtual,objVirtDir;
begin
szWaitTxt= "正在创建 " + VirtualName + " 虚拟目录....";
SdShowMsg (szWaitTxt, TRUE);
Delay(3);
set objIIS_Virtual = CoGetObject("IIS://localhost/W3SVC/1/Root", "");
szVirPath = TARGETDIR + VirtualDataPath;
if (IsObject(objIIS_Virtual)) then
try
set objVirtDir = objIIS_Virtual.Create("IISWebVirtualDir", VirtualName);
if (IsObject(objVirtDir)) then
objVirtDir.Path = szVirPath;
objVirtDir.AccessRead = TRUE;
objVirtDir.AccessScript = TRUE;
objVirtDir.AccessWrite = FALSE;
objVirtDir.EnableDirBrowsing = FALSE;
objVirtDir.EnableDefaultDoc = TRUE;
objVirtDir.AppFriendlyName = VirtualName;
objVirtDir.SetInfo();
objVirtDir.AppCreate2(2);
objVirtDir.SetInfo();
endif;
catch
MessageBox("无法创建虚拟目录,请自行创建虚拟目录!", INFORMATION);
endcatch;
endif;
end;