Edit values in appconfig.json using C# -


is there way edit value inside appsetting.json using controller?

so, here appsetting.json:

{     "person": {     "p1": "test1",     "p2": "test2",     "p3": "test3"     } } 

and class:

public class {     public string p1{ get; set; }      public string p2{ get; set; }      public string p3{ get; set; } } 

i research no clue. find how read value of appsetting.json. want edit value controller , save it.

try

configuration config = configurationmanager.openexeconfiguration(configurationuserlevel.none);              config.appsettings.settings["p1"].value = "test1";                    config.appsettings.settings["p2"].value = "test2";               config.save(configurationsavemode.modified);             configurationmanager.refreshsection("appsettings"); 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -