I am able to get physical path for any website hosted in IIS-7(C:\\Windows\\System32\\inetsrv\\config \\applicationHost.config) programmatically (C#) by passing ID as a para
Have you tried to use the new ServerManager object (available for IIS 7.0 and up, through Microsoft.Web.Administration)?
Please try using the following snippet:
using (ServerManager serverManager = new ServerManager()) {
var sites = serverManager.Sites;
foreach (Site site in sites)
{
Console.WriteLine(site.Id);
}
To obtain the ID of one site in particular, LINQ works like a charm.