Monday, January 28, 2008

在程序中创建虚拟目录(C#)

public DirectoryEntry CreateVir(string vdirname,string serverID,string vdirPath ,bool criaAppliaction)
{
DirectoryEntry newvdir,root;

string strPath ="IIS://localhost/" + serverID;
root =new DirectoryEntry(strPath);

newvdir = root.Children.Add(vdirname, "IIsWebVirtualDir");
newvdir.Properties["Path"][0] = vdirPath;

if(criaAppliaction)
{
newvdir.Invoke("AppCreate", true);
newvdir.Properties["AppFriendlyName"][0] = vdirname;
newvdir.Properties["AppIsolated"][0] = 2;
}

newvdir.CommitChanges();

return newvdir;
}


Related Posts



0 Comments:

 

gf

rgdfgfdg

gf

gf

gf