当前位置:编程学习 > C#/ASP.NET >>

MVC4 访问某文件的绝对路径,请各位大神指点。。。。。

Server.MapPath("PrintContent/ApplicationForm.rdlc")“((System.Web.Mvc.Controller)(this)).Server”为 null  string

mvc4 --------------------编程问答-------------------- 顶。。。。。。。。 --------------------编程问答-------------------- 我去,头像一样! --------------------编程问答-------------------- 能不能详细一点? --------------------编程问答-------------------- Server.MapPath 改成 Request.MapPath
--------------------编程问答-------------------- 改成 HostingEnvironment.MapPath(string virtualPath) 试试,这是个静态方法。 --------------------编程问答--------------------
要放到Controller.Initialize读取

protected override void Initialize(System.Web.Routing.RequestContext requestContext)
{
base.Initialize(requestContext);
 

folderPath = Server.MapPath("PrintContent/ApplicationForm.rdlc");
}
  
*****************************************************************************
http://feiyun0112.cnblogs.com/
补充:.NET技术 ,  .NET Framework
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,