I would like to be able to browse a directory in the web root (such as my \img directory or \pdf directory) from code within a controller.
I would like to use something like the following where env
is an instance of IWebHostEnvironment
:
var provider = env.WebRootFileProvider;
var path = env.WebRootPath;
I'm not sure how to get an instance of IWebHostEnvironment
from within a controller. How can this be done?