How do you modify the web.config appSettings at runtime?

后端 未结 7 1715
小鲜肉
小鲜肉 2020-11-22 14:28

I am confused on how to modify the web.config appSettings values at runtime. For example, I have this appSettings section:


  

        
7条回答
  •  有刺的猬
    2020-11-22 14:57

    Who likes directly to the point,

    In your Config

        
    
        
    
      
    

    in your code(c#)

    ///SET
        ConfigurationManager.AppSettings.Set("Conf_id", "whateveryourvalue");
          ///GET              
        string conf = ConfigurationManager.AppSettings.Get("Conf_id").ToString();
    

提交回复
热议问题