- 浏览: 7852314 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (2425)
- 软件工程 (75)
- JAVA相关 (662)
- ajax/web相关 (351)
- 数据库相关/oracle (218)
- PHP (147)
- UNIX/LINUX/FREEBSD/solaris (118)
- 音乐探讨 (1)
- 闲话 (11)
- 网络安全等 (21)
- .NET (153)
- ROR和GOG (10)
- [网站分类]4.其他技术区 (181)
- 算法等 (7)
- [随笔分类]SOA (8)
- 收藏区 (71)
- 金融证券 (4)
- [网站分类]5.企业信息化 (3)
- c&c++学习 (1)
- 读书区 (11)
- 其它 (10)
- 收藏夹 (1)
- 设计模式 (1)
- FLEX (14)
- Android (98)
- 软件工程心理学系列 (4)
- HTML5 (6)
- C/C++ (0)
- 数据结构 (0)
- 书评 (3)
- python (17)
- NOSQL (10)
- MYSQL (85)
- java之各类测试 (18)
- nodejs (1)
- JAVA (1)
- neo4j (3)
- VUE (4)
- docker相关 (1)
最新评论
-
xiaobadi:
jacky~~~~~~~~~
推荐两个不错的mybatis GUI生成工具 -
masuweng:
(转)JAVA获得机器码的实现 -
albert0707:
有些扩展名为null
java 7中可以判断文件的contenttype了 -
albert0707:
非常感谢!!!!!!!!!
java 7中可以判断文件的contenttype了 -
zhangle:
https://zhuban.me竹板共享 - 高效便捷的文档 ...
一个不错的网络白板工具
读取配置:
ConfigurationManager.AppSettings["MyKey"]
读取数据库的配置(这个估计大家最经常用了)
在web.config中
<connectionStrings>
<add name="AppConnectionString1" connectionString="server=localhost;database=northwind;uid=sa;password=xxxx;"/>
</connectionStrings>
在程序中如下读取:
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString1"].ConnectionString);
GETSECTION方法:
ConfigurationManager.GetSection("mySection")
其他的方法大概描述摘录如下:
GetWebAppSection
<!----><o:p> </o:p>
With the GetWebAppSection you can get the specified section from the web applications configuration file.
<o:p> </o:p>
Note: This method retrieves the specified configuration section from the configuration file located at the root folder of your Web application. If you want to retrieve the configuration section from the current Web application directory use the GetSection method.
<o:p> </o:p>
RefreshSection
<o:p> </o:p>
RefreshSection will refresh the specified section so next time its requested, it will be re-read from disk.
<o:p> </o:p>
With the following method, you will have the ability to programmatically change the settings within the configuration files. Those methods will return a Configuration class (The Configuration class has properties to get sections from the configuration file you want to edit, and by using the Save or SaveAs method, you can save the settings):
<o:p> </o:p>
OpenMachineConfiguration
<o:p> </o:p>
With the OpenMachineConfiguration, you configure the machine.config file.
<o:p> </o:p>
OpenMappedMachineConfiguration
<o:p> </o:p>
With the OpenMappedMachineConfiguration, you can open a specified configuration file.
<o:p> </o:p>
OpenExeConfiguration
<o:p> </o:p>
With the OpenExeConfiguration, you can open the client’s configuration file.
<o:p> </o:p>
OpenMappedExeConfiguration
<o:p> </o:p>
With the OpenMappedExeConfiguration, you can open the specified client configuration.
OpenWebConfiguration
<o:p> </o:p>
With the OpenWebConfiguration, you can open the web applications configuration file.
OpenMappedWebConfiguration
<o:p> </o:p>
With the OpenMappedWebConfiguration, you can open a specified web configuration file.
发表评论
-
.NET 嵌入式版4.2发布:关键更新抢先看
2012-02-22 14:57 1839作为.NET家族的一员,.Net Micro Framewor ... -
asp.net中模拟测试smtp发信
2011-03-20 18:47 1877在asp.net 中,有时要测试发信SMTP,但如果在单元测试 ... -
vs.net 2010两个数据库方面的好工具
2011-02-14 11:47 1849今天发现vs.net 2010在处理数据库方面的两个不错的工具 ... -
将gridview导出到excel,world,pdf的小结
2011-02-07 22:47 2956下面小结下把gridview的数据导出到excel,world ... -
gridviewtips1:gridview的页脚中的加亮显示和页数显示
2011-01-27 09:58 2361在asp.net 中,要经常显示gridview中的页数,并且 ... -
asp.net 4中的HTML过滤的一个新特性
2011-01-21 09:47 1861在asp.net 4中,有个新增加的对HTML过滤,防止XSS ... -
在vs.net 2010中使用重构方法
2011-01-20 16:55 2160在vs.net 2010中,可以很方便地对一些冗余的代码进行重 ... -
一个比较好的.net 3.5的异常报告类
2011-01-10 14:51 1950发现了一个比较好的异常报告类,其中用到了.net 3.5以上的 ... -
asp.net 4.0中menu菜单的改进
2011-01-03 22:47 2572在asp.net 3.5时,如果用menucontrol时,使 ... -
asp.net 4中的新特性之一:控制URL长度
2010-09-14 23:06 2390asp.net 4中的新特性之一:控制URL长度。在ASP.N ... -
vs.net 2010中使用code snippets
2010-09-09 20:58 1575其实在vs.net 2010中,使用code snippets ... -
百万开发者拥戴!七大.NET著名开源项目
2010-09-07 09:42 2288新翻译了篇帖子,原文发表在 http://publish.i ... -
asp.net 2010中jquery调用webservice
2010-08-30 22:21 2756在asp.net 2010中,在建立web应用时,默认已经在s ... -
.net中的placeholder控件
2005-01-15 20:00 1928最近留意到有人问,NET中的placeholder控件用来做什 ... -
asp.net 中一次性更新DATAGRID中所有记录
2005-01-15 20:03 943在asp.net中,如何一次性 ... -
在asp.net 中实现只允许数字输入的文本框
2005-01-15 20:18 1492在asp.net 中实现只允许数字输入的文本框,其实是十分简单 ... -
一个重构代码的小技巧
2005-01-16 21:58 1138刚开始接触重构,听就听的多了,理论没认真看过,不过今天发现,将 ... -
防止SQL注入攻击
2005-02-05 14:42 1146看了本期ASP。NET杂志里的一篇讲防止SQL注入攻击的文章, ... -
优秀.net 控件包介绍
2005-02-18 19:47 1677在oday上看到得,将介绍摘录在这里 NetAdvantage ... -
用vs.net 调试传统ASP程序
2005-05-30 22:05 1279VS.NET 2003其实也可以用来调试传统的ASP程序的,如 ...
相关推荐
一直没弄明白怎么在类库中找不到 ConfigurationManager.ConnectionStrings 后面才发现没有添加System.configuration的引用,添加后: 引入命名空间: 代码如下:using System.Configuration; 便可以使用了: 代码如下...
中小型项目的配置管理组件
主要为大家详细介绍了Net Core全局配置读取管理方法ConfigurationManager的相关资料,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
一、框架集成与集成请参考,完全支持IConfiguration的变动通知与集成(.net 4.7.1及以后版本,只支持动态修改ConfigurationManager.AppSettings)或直接使用ApolloConfigurationManager请参考如果想将传统的config配置...
在.net编程中,我们经常用到config文件...这个.config文件其实就是一个xml文件,对它的读操作微软已经提供了一个类来实现了,这个类就是System.Configuration.ConfigurationManager,下面分别是例子:.................
Dunk.Tools.Configuration 提供.NET Framework ConfigurationManager的包装器接口
主要介绍了c#读写App.config,ConfigurationManager.AppSettings 不生效的解决方法,需要的朋友可以参考下
故需改为private static int PageSize = int.Parse(ConfigurationManager.AppSettings["PageSize "]); **private static int DisplaySize = int.Parse (ConfigurationManager.AppSettings["DisplaySize"]);
移植代码基本顺利,但是发现.net core中没有ConfigurationManager,无法读写配置文件,单独写个xml之类的嫌麻烦,就谷歌了下,发现了个方法,遂记录如下,方便以后查找: 方法如下 配置文件结构 public class ...
Configuration Manager的客户中心提供了快速简便的客户端设置概述,包括在良好且易于使用的用户界面中运行服务和代理设置。 资料下载 离线安装程序 ClickOnce设置 MSIX设定 包管理器 Windows 10商店 文献资料 ...
如果您是在类中间使用ConfigurationManager.AppSettings的那些开发人员之一,那么请停止,请停止。
smallfoldername = Server.MapPath(ConfigurationManager.AppSettings["SmallPath"]); bigfoldername = Server.MapPath(ConfigurationManager.AppSettings["NormalPath"]); } catch { smallfoldername = ...
csdn无法免积下载,只能选最少的1个积分了 使用最新的16.3.0.36版本,含: Syncfusion.Compression.Portable Syncfusion.DocIO.Portable.dll ...System.Configuration.ConfigurationManager System.Data.SqlClient
string myStr = ConfigurationManager.ConnectionStrings["DataBaseConnectionString4"].ToString(); SqlConnection myConn = new SqlConnection(myStr); SqlCommand myCmd = new SqlCommand("select count(*) ...
con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;//ConnectionString con.Open(); SqlCommand cmd = new SqlCommand(); cmd....
而要在代码中获得文件中的配置信息,ConfigurationManager则是必不可少需要引入的程序集。 然而到了ASP.NET Core时代,存储与读取配置的方式都发生了改变。 如果对ASP.NET Core项目有所了解的话,应该会看到过...
SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["ConSQL"]); mycon.Open(); string cmdtxt2 = "SELECT * FROM tb_Reply WHERE ReplyID='" + Request["ID"].ToString() + "'"; ...
static string constr = ConfigurationManager.ConnectionStrings["tblConnectionString"].ConnectionString.ToString(); SqlConnection conn = new SqlConnection(constr); conn.Open(); SqlCommand cmd = new ...
FCKeditor 网页文本编辑器(asp.net),使用的时候注意设置页面的属性ValidateRequest="false"。 1.引用FredCK.FCKeditorV2.dll。 2.打开网站,选择工具箱,找到其中 常规 选项卡 ,点击右键选择 -->选择项--->浏览 ...