📌  相关文章
📜  从 wwwroot 文件夹获取 .net core 中的文件路径 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:16.904000             🧑  作者: Mango

代码示例1
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();
    }
}