读书人

当前下上文中不存在名称“HttpContext

发布时间: 2012-08-13 13:21:53 作者: rapoo

当前上下文中不存在名称“HttpContext”

C# code
        private XmlDocument loadConfigDoc(XmlDocument cfgDoc)        {            // load the config file               if (Convert.ToInt32(ConfigType) == Convert.ToInt32(ConfigFileType.AppConfig))            {                docName = ((Assembly.GetEntryAssembly()).GetName()).Name;                docName += ".exe.config";            }            else            {                docName = HttpContext.Current.Server.MapPath("web.config");//错误在这里            }            cfgDoc.Load(docName);            return cfgDoc;        }

我按System.Web.自动完成也没有HTTPcontext这个类!

[解决办法]
winform 里肯定为空,因为这个属性只有在网站里才会被加载。

读书人网 >C#

热点推荐