I
idiot
public DirectoryEntry Find(string, string) method get Exception from
HRESULT: 0x80005008
public DirectoryEntry Find(string); method get NullReferenceException
source code :
string strSchema = "IIsWebVirtualDir";
string strRootSubPath = "/W3SVC/1/Root";
DirectoryEntry deRoot= new DirectoryEntry("IIS://localhost" +
strRootSubPath);
try
{
DirectoryEntry deNewVDir =
deRoot.Children.Add("docula5",deRoot.SchemaClassName);
deNewVDir.Properties["Path"].Insert(0,"D:\\temp");
// Create a Application
deNewVDir.Properties["AccessRead"].Add(true);
deNewVDir.Properties["AccessScript"].Add(true);
deNewVDir.Properties["Path"].Add("D:\\temp");
deNewVDir.Properties["AppFriendlyName"].Add("docula5");
deNewVDir.Invoke("AppCreate",true);
// Save Changes
deNewVDir.CommitChanges();
deRoot.CommitChanges();
deNewVDir.Close();
deRoot.Close();
DirectoryEntry rootfolder = new
DirectoryEntry("IIS://localhost/W3SVC/1/ROOT");
DirectoryEntry de = rootfolder.Children.Find("docula5",
"IIsWebVirtualDir");//,rootfolder.SchemaClassName);
win2000 Pro
HRESULT: 0x80005008
public DirectoryEntry Find(string); method get NullReferenceException
source code :
string strSchema = "IIsWebVirtualDir";
string strRootSubPath = "/W3SVC/1/Root";
DirectoryEntry deRoot= new DirectoryEntry("IIS://localhost" +
strRootSubPath);
try
{
DirectoryEntry deNewVDir =
deRoot.Children.Add("docula5",deRoot.SchemaClassName);
deNewVDir.Properties["Path"].Insert(0,"D:\\temp");
// Create a Application
deNewVDir.Properties["AccessRead"].Add(true);
deNewVDir.Properties["AccessScript"].Add(true);
deNewVDir.Properties["Path"].Add("D:\\temp");
deNewVDir.Properties["AppFriendlyName"].Add("docula5");
deNewVDir.Invoke("AppCreate",true);
// Save Changes
deNewVDir.CommitChanges();
deRoot.CommitChanges();
deNewVDir.Close();
deRoot.Close();
DirectoryEntry rootfolder = new
DirectoryEntry("IIS://localhost/W3SVC/1/ROOT");
DirectoryEntry de = rootfolder.Children.Find("docula5",
"IIsWebVirtualDir");//,rootfolder.SchemaClassName);
win2000 Pro