Virtual Directory Detection

A

Amos Soma

Anyone know how I can programatically detect whether a virtual directory
exists on a machine my app is running on? And how to retrieve information
about that virtual directory?

Thanks very much. Amos.
 
G

Guest

Amos,
You would need to read from the IIS Metabase on the machine for this. See the

System.DirectoryServices namespace, and you would use a path like
@"IIS://localhost/W3SVC/1/ROOT/Dir1/";

--etc.

Peter
 
A

Amos Soma

Peter,

Thanks very much. This works. One additional item I need to find out is the
directory the virtual directory in question points to. I cannot seem to
determine how to get this.

For example, I have the following C# code. It correctly finds the
'MyVirtualDirectory' virtual directory. Now, what method do I call to
determine what folder 'MyVirtualDirectory' points to?

DirectoryEntry virtualDirectory = new
System.DirectoryServices.DirectoryEntry("IIS://localhost/W3SVC/1/Root/MyVirtualDirectory");
 

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