亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

web.config動態修改節點問題

web.config動態修改節點問題

嚕嚕噠 2018-08-10 08:05:50
如何動態修改web.config中pages節點中theme值?1 <configuration> 2     <configSections> 3     </configSections> 4     <appSettings/> 5     <system.web> 6     <pages theme="Aqua"> 7     </pages> 8   </system.web> 9 </configuration> 注:新建一頁面,在text文本框中輸入值后,點擊修改,即可修改成功。如何實現這個功能。求助……
查看完整描述

2 回答

?
吃雞游戲

TA貢獻1829條經驗 獲得超7個贊

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("web.config"));
xmlDoc.SelectSingleNode("configuration").SelectSingleNode("system.web").SelectSingleNode("pages").Attributes["theme"].Value = "abc";
xmlDoc.Save(Server.MapPath("web.config"));

測試過


查看完整回答
反對 回復 2018-08-13
?
藍山帝景

TA貢獻1843條經驗 獲得超7個贊

protected void btnTheme_Click(object sender, EventArgs e)
{
Configuration webConfig = WebConfigurationManager.OpenWebConfiguration("~");
((PagesSection)(webConfig.GetSectionGroup("system.web").Sections["pages"])).Theme = “MyTheme”;
webConfig.Save(ConfigurationSaveMode.Modified);
}


查看完整回答
反對 回復 2018-08-13
  • 2 回答
  • 0 關注
  • 768 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號