ASP.NET Core Interview Question #40
What is the wwwroot folder in ASP.NET Core?
Application Structure & Configuration Junior Beginner
Quick Interview Answer
wwwroot is the conventional web root directory for publicly served static files. It commonly contains CSS, JavaScript, images, fonts, and client-side libraries.
Detailed Explanation
wwwroot is the conventional web root directory for publicly served static files. It commonly contains CSS, JavaScript, images, fonts, and client-side libraries.
Files outside the web root are not directly exposed as static files by the standard static-file middleware. UseStaticFiles() enables serving files from the configured web root.
Sensitive application files should never be placed in wwwroot because content there is intended to be publicly accessible when static file serving is enabled.
Code Example
var app = builder.Build();
app.UseHttpsRedirection();
app.UseStaticFiles(); // Serves files from wwwroot by default.