I am trying to write a simple program to list the virtual directories of an IIS server, which is on a different domain than my local machine. When creating the root DirectoryEntry object, I tried to pass in the credentials with a domain qualifier, like this:
DirectoryEntry entry = new DirectoryEntry("IIS://myremoteserver/W3SVC/1/Root", "mydomain\\myusername", "mypassword");
I get an “Access is Denied” exception, however. Is this the right way to do this? All the code examples I’ve found only access the local web server.
I running WinXP SP3 locally, and trying to connect to a Win2003 R2 (64-bit) server running IIS version 6.0.
I decided to use the System.Management classes to do this instead, which works when I use a domain qualifier in the login: