开发者

web.config in asp.net

i want to give the values of username,password and APIKey i开发者_C百科n web.config which are coming from database.means whatever the admin set username,password,APIkey that has to be set in web.config. how can i change this.Any idea.

thank you.


 private void UpdateConfig(string strKey, string strValue)
{
   Configuration objConfig =
      WebConfigurationManager.OpenWebConfiguration("~");
   AppSettingsSection objAppsettings =
      (AppSettingsSection)objConfig.GetSection("appSettings");
   if (objAppsettings != null)
   {
      objAppsettings.Settings[strKey].Value = strValue;
      objConfig.Save();
   }
}

But it will restart your application domain every time you update the web.config file, so, updating the web.config frequently is not advisable.

Pls refer : Editing Web.config programatically

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜