首页 >> VS.NET

如何读取web.config中自定义的信息

2012-08-13 21:29:12

如何读取web.config中自定义的信息:

它本身就是一个xml文件,可以按照读取xml文件得方法来读取其中得数据:

代码如下:
XmlDocument xml = new XmlDocument();
                var configPath = new System.Web.UI.Page().Server.MapPath("~\\web.config");
                xml.Load(configPath);
                var node = xml.SelectSingleNode("configuration");