关于<appSettings file="app.config" >引用外部文件的配置值
2013-08-13 14:24
661 查看
web.config文件中,appSetting节点引用了外部的配置文件,
app.config部分信息如下:
读取的话,直接用
就可以了,但是如果要修改呢?这个时候用
<appSettings file="app.config"> </appSettings>
app.config部分信息如下:
<?xml version="1.0" encoding="gb2312"?> <appSettings> <!--平台名称--> <add key="PlatForm" value="嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻"/> <add key="DAL" value="MYTestDemo.SQLServerDAL"/> <add key="Skin" value="Red"/> <!--考试页面--> <add key="ExamUrl" value="Exam"/>
读取的话,直接用
System.Configuration.ConfigurationManager.AppSettings["ExamUrl"]
就可以了,但是如果要修改呢?这个时候用
ConfigurationManager.OpenExeConfiguration方法来处理。
Configuration configs = ConfigurationManager.OpenExeConfiguration("aaa.config"); //邮件设置 configs.AppSettings[MailConfigKey.FromAddr] = shopconfig.FromAddr;
相关文章推荐
- 关于<appSettings file="app.config" >引用外部文件的配置值
- 关于JSP中单击任意标签弹出文件选择框(<input type="file"/>)的实现方法
- <h1>读取配置文件失败</h1>这通常意味着文件中有语法错误,请检查下面显示出的错误。<br /><br /><iframe src="show_config_errors.php" />
- 关于使用注解的Spring配置文件的配置<context:annotation-config/>&&<context:component-scan base-package=”XX.XX”/>
- 关于jsp中<input type="file">获取路径问文件名,获取完全路径问题
- 关于<AppName>-Prefix.pch文件的用法
- 关于<input type="file">样式的美化
- struts.xml配置文件中result的语法:<result name="" type="">xxxxx</result>
- <meta attribute="???">xxxx</meta>的用法 - hibernate配置文件生成java类
- <%@include file="a.jsp"%> jsp引用jsp文件时候注意
- Spring配置文件详解一:<context:annotation-config/>与<context:component-scan base-package="com.xx
- Spring的配置文件applicationContext.xml中的 <context:component-scan base-package="com.orm" />
- 有时头文件引用为什要用双引号("")而不是尖括号呢"<>"?
- 关于Spring中的<context:annotation-config/>配置
- web.config中配置数据库连接的两种方式(<appSettings >与 <connectionStrings>)
- 关于<AppName>-Prefix.pch文件的科幻用法
- 关于Spring中的<context:annotation-config/>配置
- 关于Spring中的<context:annotation-config/>配置
- 任意美化你的文件域 <input type="file" />
- 关于<AppName>-Prefix.pch文件的科幻用法