读取配置文件方法

方法1:

System.Collections.Specialized.NameValueCollection nvc = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection(sectionName);

string keyValue = nvc.GetValues(keyName)[0].ToString();

方法2:

System.Web.Configuration.WebConfigurationManager.AppSettings[keyName].ToString();

 

参考:

 
  

http://blog.sina.com.cn/s/blog_4c2e288b010008c1.html

http://www.cnblogs.com/gerry-bj/archive/2008/08/06/1261712.html

你可能感兴趣的:(读取配置文件)