This is how;
public class HomeController : Controller {
    private IWebHostEnvironment _hostEnvironment;
    public HomeController(IWebHostEnvironment environment) {
        _hostEnvironment = environment;
    }
    [HttpGet]
    public IActionResult Get() {
        string path = Path.Combine(_hostEnvironment.WebRootPath, "Sample.PNG");
        return View();
    }
}References

 Add to favorites
Add to favorites