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,667
  • 1
  • 17
  • 24

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
  • 8,760
  • 6
  • 40
  • 54