<identity impersonate="true" password="password" userName="userName" />
Configuration config = serverManager.GetWebConfiguration("Default Web Site"); ConfigurationSection applicationPoolsSection = config.GetSection("system.web"); // ===> This says that I need an extra //section, if I change it to "system.web/?" ?=anything... it will fail at addElement. ConfigurationElementCollection applicationPoolsCollection = applicationPoolsSection.GetCollection(); ConfigurationElement addElement = applicationPoolsCollection.CreateElement("identity"); addElement["key"] = "impersonate"; addElement["value"] = "true"; applicationPoolsCollection.Add(addElement); serverManager.CommitChanges();
<system.web> <!--Some code here including handlers....--> <!--The below line needs to be added at runtime from a different app as the installer (made by someone else) creates the app and pools in IIS--> <identity impersonate="true" password="password" userName="username" /> </system.web>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)