I am trying something like
public string[] RegisterInApplicationConfig()
{
using (ServerManager serverManager = new ServerManager())
{
Configuration config = serverManager.GetApplicationHostConfiguration();
var section = config.GetSection("location/system.webServer/modules");
}
}
but error I am getting is -
The configuration section location/system.webServer/modules cannot be read because it is missing a section declaration.
I am referring post from to add HttpModule -
How do I register a HttpModule in the machine.config for IIS 7?
So Basically in ApplicationHostConfig I need to get to
<location path="" overrideMode="Allow">
<system.webServer>
<modules>
<add name="IsapiFilterModule" lockItem="true" />
So I found the solution after some hit & trials. Might help someone in future-
I needed to do
GetCollectionon "system.webServer/modules" section