Q: ASP.net Core: How to get file data from Service? Good day. I need to get path of a specific .txt file. From Service class i can call AppContext.BaseDirectory and it get me path to folder where placed .exe:
C:\Users\XXX\Documents\Visual Studio 2015\Projects\MyProject\src\MyProject\bin\Debug\netcoreapp1.0"
But what i need to do if i need to get file from path:
`C:\Users\XXX\Documents\Visual Studio 2015\Projects\MyProject\src\Core\Common\MyFile.txt`

Use fixed path - it's bad solution, i think

A: you need to use something like this 
Server.MapPath("~/files/myFile.txt") 

which will get you to your file as long as your folder structure (based on this example) is
Root | Files | myFile.txt
Edit
my bad, there is no Server.MapPath in ASP.Net Core, take a look at this and this should give you the concept you need in addition with my answer here 
how to get server.MapPath in asp.net core from inside a helper
