Protecting File Access in the wwwroot Folder in ASP.NET - Rick Strahl's Weblog
ASP.NET Core treats files in wwwroot as public static content, but occasionally applications create files there that should only be available to authorized users. In this post I look at several ways to protect those files and show a small middleware solution that lets selectively access files easily.