这个是我的web.config里面配置的信息,请问我在一个类库里面如何读取web.config里面的key的value值,我用了ConfigurationManager.AppSettings 是获取不到的,命名空间我也引用了,using System.Configuration;
<appSettings>
<add key ="objecttype" value="COM"/>
</appSettings>

解决方案 »

  1.   

    ConfigurationManager.AppSettings 是获取不到的 ===============不会吧,查查 key 写的正确吗?
      

  2.   

    可以读取的,你必须在asp.net运行的时候读取例如测试代码
    writer.WriteLine(System.Configuration.ConfigurationSettings.AppSettings["objecttype"]);
      

  3.   

    systemFramework.DatabaseConfiguration.objecttype
      

  4.   

    我的意思是这样的,我现在不是有一个库类A嘛,现在B网站的程序调用这个A这个类库,web.config是在B网站下面的,而现在用A获取的web.config这样可以实现吗?
    我在类库里面加了下面的代码,但是ConfigurationManager 这个在VS里面直接都不变颜色。
    using System.Configuration;
    ConfigurationManager.AppSettings 
      

  5.   

    可以实现,
    System.Configuration.ConfigurationSettings.AppSettings["objecttype"]