0

I have an <applicationSettings> tag in my web.config file which contains <connectionString> and other settings related to the application.

I want to ask If I want to add some more settings to the <applicationSettings> section. How can I do that?

Is it possible to edit/add tags in the <applicationSettings> section of the web.config file?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • possible duplicate of [Change a web.config programmatically with C# (.NET)](http://stackoverflow.com/questions/2260317/change-a-web-config-programmatically-with-c-sharp-net) – coder Jun 04 '14 at 14:30
  • If all you want to do is read a setting from the web.config then check out [Reading a key from the Web.Config using ConfigurationManager](http://stackoverflow.com/questions/4595288/reading-a-key-from-the-web-config-using-configurationmanager) – Matthew at Critical Cognition Jun 04 '14 at 17:52
  • Can you post the config file? If there is an actual `` element (as opposed to the standard `` element) you may be dealing with a custom configuration section. – Tim Jun 04 '14 at 17:57
  • For example I have an application setting Tag like this Illinois Iowa Now I am able to get the 1st value from the applicationSettings. However When I try to get the second value and replace the first value on the front end , It doesnt work. – user3608997 Jun 05 '14 at 12:33

1 Answers1

0

You mean at runtime? When the application is published? Sometime else? The config file can be edited within Visual Studio.. or even just good ol' notepad. You can definitely edit it, you just need to follow the appropriate XML structure provided, meaning appsetting keys use a NameValueCollection - http://msdn.microsoft.com/en-us/library/vstudio/ms228154(v=vs.100).aspx

ewitkows
  • 3,528
  • 3
  • 40
  • 62
  • Not at runtime. It should retrieve value from the applicationSettings at Runtime.For example I want to store a string in the and retrieve at run time . I tried but could not load it at run time. Any Suggestions ? – user3608997 Jun 04 '14 at 14:46
  • What have you tried? Check out this answer: http://stackoverflow.com/questions/4595288/reading-a-key-from-the-web-config-using-configurationmanager?lq=1 – ewitkows Jun 04 '14 at 18:11