Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. app.config I can't add or remuve values.

app.config I can't add or remuve values.

Scheduled Pinned Locked Moved C#
helpworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    daavena
    wrote on last edited by
    #1

    Hi all I am trying to save my settings into app.config but it doesn't work. I can read data but I can't save it. I see no error. Can you give me a hint. Here is my code. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings.Remove("ClientPort"); config.AppSettings.Settings.Add("test", "23232"); config.Save(ConfigurationSaveMode.Full, true); ConfigurationManager.RefreshSection("appSettings"); Thanks.

    L 1 Reply Last reply
    0
    • D daavena

      Hi all I am trying to save my settings into app.config but it doesn't work. I can read data but I can't save it. I see no error. Can you give me a hint. Here is my code. System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings.Remove("ClientPort"); config.AppSettings.Settings.Add("test", "23232"); config.Save(ConfigurationSaveMode.Full, true); ConfigurationManager.RefreshSection("appSettings"); Thanks.

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      daavena wrote:

      ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

      User based .config files live in another location, somewhere in Documents and Settings/Username/blah/blah. You probably want to use: PerUserRoamingAndLocal

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 4a out now (29 May 2008)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups