Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ServerManager How to get site's physical path on disk?

Tags:

c#

.net

iis-7

How I can get physical path of site on a disk ?

using (ServerManager serverManager = new ServerManager()) { 

var sites = serverManager.Sites; 
foreach (Site site in sites) { 
         Console.WriteLine(site.Name); // This will return the WebSite name
        //but how i get it's path on disc ??????

}
like image 361
Night Walker Avatar asked Mar 25 '11 11:03

Night Walker


1 Answers

ServerManager m = new ServerManager();  
m.Sites["default web site"].Applications["/"].VirtualDirectories["/"].PhysicalPath;

basically every site has a "root application" which must have a "root virtual directory".

like image 80
Carlos Aguilar Mares Avatar answered Sep 23 '22 14:09

Carlos Aguilar Mares