Map the physical file path in asp.net mvc

前端 未结 3 1507
既然无缘
既然无缘 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:21

    If you're using WebApi or not specifically within a controller class, you can use the following as an alternative:

    HostingEnvironment.MapPath("/Content/Xsl/pubmed.xslt")
    

提交回复
热议问题