Learn how to serve static files (such as images, CSS, JavaScript, and more) in your ASP.NET Core applications. This guide explains how to configure and manage static file middleware, set up file serving, and handle custom routes, caching, and security for static content in your web applications.
Static file serve from wwwroot folder in asp.net core application
DefaultFilesOptions obj = new DefaultFilesOptions() ;
obj.DefaultFileNames.Clear();
obj.DefaultFileNames.Add("htmlpage.html");
app.UseDefaultFiles(obj);
app.UseStaticFiles();