public static string GetValue(string key, string FileName)
{
string XPath = "/appSettings/add[@key='?']";
XmlDocument membershipConfig = new XmlDocument();
membershipConfig.Load((HttpContext.Current.Server.MapPath(FileName)));
XmlNode addKey = membershipConfig.SelectSingleNode((XPath.Replace("?", key)));
if (addKey == null)
{
throw new ArgumentException("没有找到<add key='" + key + "' value=.../>的配置节");
}
return addKey.Attributes["value"].InnerText;
}