Map the physical file path in asp.net mvc

前端 未结 3 1550
既然无缘
既然无缘 2021-02-02 06:57

I am trying to read an XSLT file from disk in my ASP.Net MVC controller. What I am doing is the following:

string filepath = HttpContext.Request.PhysicalApplicat         


        
3条回答
  •  轮回少年
    2021-02-02 07:03

    string filePath = Server.MapPath(Url.Content("~/Content/Xsl/"));
    

    I disagree with the idea that HttpContext.Current is "evil." It's not the hammer for every problem, but it is certainly better than, e.g., Session for stuff that it can do OK.

提交回复
热议问题