Answers for "get file path in .net core from wwwroot folder"

C#
0

get file path in .net core from wwwroot folder

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();
    }
}
Posted by: Guest on May-20-2021

Code answers related to "get file path in .net core from wwwroot folder"

C# Answers by Framework

Browse Popular Code Answers by Language