DirectoryEntries.Find Method get Exception from HRESULT: 0x80005008 or NullReferenceException

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
 
M

Meher

ASP.NET Gurus,

I have similar problem on Windows Server 2003, while finding an
existing website. The same find works if there is no website found,
but fails with the similar exception when finding a specific website
in the list of websites.

Your help is greatly appreciated.

Thanks
Meher/-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top