在Web.config文件中那一行添加<add key="xxx">这种标题?我添加总是错的?

解决方案 »

  1.   

    <appSettings>   
      <add   key="ConnectionString"   value="data   source=Meng;initial   catalog=Document;user   id=sa;password=123456;packet   size=4096   ;"></add>   
      </appSettings>   
        
     
    下面是在 DBHelper.cs 类中:   
      public   static   string   ConnectionString=System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
    我也是在csdn 里面收录的,发给你看看吧
      

  2.   

    <?xml version="1.0" encoding="utf-8"?><configuration>
      
        <appSettings/>
        <connectionStrings/>
     
        <system.web>
            <!-- 
                设置 compilation debug="true" 可将调试符号插入
                已编译的页面中。但由于这会 
                影响性能,因此只在开发过程中将此值 
                设置为 true。
            -->
            <compilation debug="false">        </compilation>
            <!--
                通过 <authentication> 节可以配置 ASP.NET 用来 
                识别进入用户的
                安全身份验证模式。 
            -->
            <authentication mode="Windows" />
            <!--
                如果在执行请求的过程中出现未处理的错误,
                则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
                开发人员通过该节可以配置
                要显示的 html 错误页
                以代替错误堆栈跟踪。        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
            -->    </system.web></configuration>
    这是默认的。
    写在那个位置呢?
      

  3.   

    一个比较通用的  Web.config配置
      http://blog.sina.com.cn/s/blog_5ea9354f0100dhrf.html
      

  4.   

    <appSettings/>  你的默认里有这个 你把这个改成一对就可以了或者你也可以用 楼上的 那个 是比较好的了
      

  5.   

    如果楼主要在web.config中自定义配置节点.必须要有实现IConfigurationSectionHandler接口的类...
    http://blog.csdn.net/ojekleen/archive/2008/12/17/3540567.aspx