private void BtnReadWeb_Click(object sender, EventArgs e)
{
string webPath = System.Web.HttpContext.Current.Server.MapPath("") + @"\Web.config";
System.Console.ReadLine();
}
总是出现:未将对象引用设置到对象的实例
谢谢各位兄长,怎么解决!
为什么:System.Web.HttpContext.Current.Server.MapPath("") 这句总是出现"未将对象引用设置到对象的实例"异常呢?
{
string webPath = System.Web.HttpContext.Current.Server.MapPath("") + @"\Web.config";
System.Console.ReadLine();
}
总是出现:未将对象引用设置到对象的实例
谢谢各位兄长,怎么解决!
为什么:System.Web.HttpContext.Current.Server.MapPath("") 这句总是出现"未将对象引用设置到对象的实例"异常呢?
private void BtnReadWeb_Click(object sender, EventArgs e)
{
string webPath = System.Web.HttpContext.Current.Server.MapPath( @"\Web.config");
System.Console.ReadLine();
}
如果是控制台程序的话你哪来的HTTPCONTEXT?
web里Response.Write("");