471,605 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

Virtual Directory Detection

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.

Jan 13 '06 #1
2 1971
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Amos Soma" wrote:
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.


Jan 13 '06 #2
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");

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:C5**********************************@microsof t.com...
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Amos Soma" wrote:
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.


Jan 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Leszek | last post: by
2 posts views Thread by Danny Miller | last post: by
4 posts views Thread by david | last post: by
7 posts views Thread by Amos Soma | last post: by
8 posts views Thread by wally | last post: by
6 posts views Thread by Scott M. | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.