Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are looking for <strong><a href="http://msdn.microsoft.com/it-it/library/microsoft.web.administration.servermanager.sites.aspx" rel="noreferrer">ServerManager</a></strong> (<em>Microsoft.Web.Administration</em>) which provides read and write access to the IIS 7.0 configuration system.</p> <p>Iterate through Microsoft.Web.Administration.SiteCollection, get a reference to your website using the Site Object and read the value of the Name property.</p> <pre><code>// Snippet using (ServerManager serverManager = new ServerManager()) { var sites = serverManager.Sites; foreach (Site site in sites) { Console.WriteLine(site.Name); // This will return the WebSite name } </code></pre> <p>You can also use LINQ to query the ServerManager.Sites collection (see example below)</p> <pre><code>// Start all stopped WebSites using the power of Linq :) var sites = (from site in serverManager.Sites where site.State == ObjectState.Stopped orderby site.Name select site); foreach (Site site in sites) { site.Start(); } </code></pre> <p><strong>Note</strong> : Microsoft.Web.Administration works <strong>only</strong> with <strong>IIS7</strong>.</p> <p>For IIS6 you can use both ADSI and WMI to do this, but I suggest you to go for WMI which is faster than ADSI. If using WMI, have a look at <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&amp;displaylang=en" rel="noreferrer">WMI Code Creator 1.0</a> (Free / Developed by Microsoft). It will generate the code for you. </p> <p>HTH</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload