1

I want to edit a web.config to add some sections programatically. For example and <configSections>. How can I go about achieving this in C#? My application is ASP.Net website.

I know that I can do WebConfigurationManager.GetSection("system.identityModel") to get an instance of the identity section, but cant see any way of actually editing/adding it?

tichra
  • 557
  • 5
  • 18
  • Did you look at this one https://social.msdn.microsoft.com/Forums/vstudio/en-US/d68a872e-14bc-414a-82c4-d1035a11b4a8/how-do-i-updateinsertremove-the-config-file-during-runtime?forum=csharpgeneral – J.SMTBCJ15 Mar 07 '17 at 12:17
  • [http://stackoverflow.com/questions/2260317/change-a-web-config-programmatically-with-c-sharp-net](http://stackoverflow.com/questions/2260317/change-a-web-config-programmatically-with-c-sharp-net) – Shady Mar 07 '17 at 12:18
  • This is only for AppSettings section. As in the question, I need to for example add system.identityModel section. – tichra Mar 07 '17 at 12:22

0 Answers0