asp.net 得不到<configSections> 里的值,兄弟姐妹帮帮忙啊

来源:百度知道 编辑:UC知道 时间:2024/05/21 12:42:04
web.config
<configSections>
<section name="Conn" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</configSections>

用 string strConn = ConfigurationManager.ConnectionStrings["Conn"].ToString();在一级目录能得到值,二级目录就得不到.请大家帮我下
ConnectionString 属性尚未初始化 这个出错信息

我没写错,是我控件没绑嘿嘿.分给热心人了

ConfigurationManager.ConnectionStrings["Conn"]这个是用来读链接字符串的

<connectionStrings>
<add name="Conn" connectionString="....."/>
</connectionStrings>
在</configSections>后边加上这个节点就可以了!
建议你看下webconfig 的配置!