'Using Microsoft.Web.Administration getting IIS App Pool Names

Currently on Using Microsoft.Web.Administration and running below C# code in console getting AppPoolname as correctly "DefaultAppPool"

but when on executing the same from Web Form as web project getting the AppPoolName as Clr4IntegratedAppPool, Clr4ClassicAppPool, Clr2IntegratedAppPool, Clr2ClassicAppPool, UnmanagedClassicAppPool

Whats wrong in below

ServerManager serverManager = new ServerManager();
ApplicationPoolCollection appPools = serverManager.ApplicationPools;
foreach (ApplicationPool ap in appPools)
{
    string poolname = ap.Name;
    ListItem item = new ListItem(poolname);
    apppoolname.Items.Add(item);
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source