Configuration命名空间找不到ConfigurationManager

这里谈到是三层编程在CLASS里调用的问题:

开始使用VS 2005,习惯性的使用ConfigurationSettings类来读取应用程序配置文件的信息时,却被编译器提示说:警告 1 “System.Configuration.ConfigurationSettings.AppSettings”已过时:“This method is obsolete,it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings”于是转而想找到那个ConfigurationManager类来使用,结果在System.Configuration命名空间下死活找不到ConfigurationManager类,无奈,求助于网络,才知道原来还要~~添加对System.Configuration.dll的引用

当前类库中添加引用 选择COM组件System.Configuration添加即可!!!

如: string constr = ConfigurationManager.AppSettings["ConnectionString"].ToString();

又如:

System.Web.HttpContext.Current.Cache["Cache1"] = "Value1";

posted @ 2013-01-02 21:21  WsHiteam  阅读(220)  评论(0编辑  收藏  举报