4

I am trying to convert an MVC 5 project to MVC 6 with ASP.NET Core. In the old project, I had a static HTML helper class which I used to render inline css.

I used to be able to use HttpContext.Current.Server.MapPath(path) to get the root outside a controller, but this exists in System.Web and so is not available to me.

What equivalent can I use in ASP.NET Core to MapPath outside of a Controller class (ie, I do not have access to IHostingEnvironment)

Aleksandr Albert
  • 1,777
  • 1
  • 19
  • 26

1 Answers1

-2

You may find the answer which is a complete solution (MapPath(), IsPathMapped(), UnmapPath()) to this question: Reading a file in MVC 6.

Alexander Christov
  • 9,625
  • 7
  • 43
  • 58