rt
解决方案 »
- 关于静态与动态的问题,请大家提提建议和意见
- GridView1.Rows[GridView1.EditIndex].Cells[0].Text = ((TextBox)GridView1.Rows[GridView1.EditIndex].Controls[0].Controls[0]).Text
- 求web.config设置的问题??
- 工程启动时提示:http/1.1 400 Bad Request,怎么回事?急!
- 求教高手,这段代码哪里出错了啊
- 请问各大侠,在WEB.config里DSN怎么设置
- 求!!!!将写入数据库有五分钟时间的记录自动删除的写法
- ◆◆◆差点吐血,我在数据库里加了个带默认值,可为空的字段,同事的程序报错了,大家猜猜是什么原因
- URL中传递的值为一个变量可以吗?
- 不设虚拟目录,使用codebehind,怎样Inherits.
- 如何设置IIS缓存
- C# 里有 DateTimePicker 控件, asp.net 里怎么没有?
/// <summary>
/// 修改web.config文件appsettings配置节中的add里的value属性
/// </summary>
/// <res>
/// 注意,调用该函数后,会使整个web application重启,导致当前所有的会话丢失
/// </res>
/// <param name="key">要修改的键key</param>
/// <param name="strvalue">修改后的value</param>
/// <exception cref="">找不到相关的键</exception>
/// <exception cref="">权限不够,无法保存到web.config文件中</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("没有找到<add key=" + key + " value=.../>的配置节");
}
addkey.Attributes["value"].InnerText = strvalue;
domwebconfig.Save(HttpContext.Current.Server.MapPath("/web.config"));
}