System.Configuration.Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~"); // Get the section. AuthenticationSection authenticationSection = (AuthenticationSection)config.GetSection("system.web/authentication"); XmlDocument doc=new XmlDocument(); //Request.PhysicalApplicationPath取得config文件路径 doc.Load(Path.Combine(Request.PhysicalApplicationPath,"web.config")); XmlNode node=doc.SelectSingleNode("configuration/system.web/httpRuntime/@maxRequestLength"); double length=Convert.ToDouble(node.Value);