Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Get all site names in IIS using C#

Posted on 2014-08-26
2
Medium Priority
?
321 Views
Last Modified: 2014-08-27
Hi Experts,

I am trying to get  all site names under iis and tried following code but could not find property under sites collection that contains names of sites.Am I missing any property?

var iisManager = new ServerManager();
        SiteCollection sites = iisManager.Sites;

Open in new window

0
Comment
Question by:ksd123
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 1500 total points
ID: 40286484
foreach (Site site in sites)
{
    Console.WriteLine(site.Name);
}

Open in new window


Following is a decent starting reference for the library you are using:

http://www.iis.net/learn/manage/scripting/how-to-use-microsoftwebadministration
0
 

Author Closing Comment

by:ksd123
ID: 40288556
Thank you
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question