I'm building a small site to deploy locally that I'd like to use to list and link to all the other web applications I have installed locally.
Here's some quick test code that accomplishes something similar to what I'm trying to achieve, but can only get the names of the applications not the address to access them from a browser.
using System;
using Microsoft.Web.Administration;
namespace IISListerTest
{
class Program
{
static void Main(string[] args)
{
var iisManager = new ServerManager();
SiteCollection sites = iisManager.Sites;
foreach (Site site in sites)
{
foreach (Application app in site.Applications)
{
Console.WriteLine(app.Path);
}
}
}
}
}