A function of modifying the appSettings configuration section in web.config
This function mainly uses XMLDocument to parse Web.config. And use the selectsinglenode () method to locate the configuration section you want to modify. It is important to pay attention to the last program to save (), so your APSNET account must have write permissions to Web.config.
/// // / Modify the value attribute /// // /// of the addset in the web.config file appsettings configuration section, which will make the entire Web Application Restart, resulting in all current sessions lost /// remarks> /// Key param> /// modified Value param> /// /// If the permissions are not enough, it cannot be saved to the web.config file exception > public void Modify (string key, string strValue) {string XPath = "/ configuration / appSettings / add [@ key = '?']"; XmlDocument domWebConfig = new XmlDocument (); domWebConfig.Load ((HttpContext.Current.Server .Mappath ("Web.config")))); XMLNode AddKey = DomWebconfig.selectsinglenode ((xpath.replace ("?", Key)); if (addkey == null) {throw new argumentException ("Did not find