ASP.NET Core Interview Question #22

What is the web root and wwwroot folder?

ASP.NET Core Fundamentals Junior Beginner

Quick Interview Answer

The web root is the base directory for public static web assets. By convention, ASP.NET Core uses the wwwroot folder as the web root.

Detailed Explanation

The web root is the base directory for public static web assets. By convention, ASP.NET Core uses the wwwroot folder as the web root.

Files such as CSS, JavaScript, images, and client libraries placed under wwwroot can be served when static-file middleware is enabled. Application source code, configuration files, and secrets should not be placed there because the folder is intended for publicly accessible content.

Code Example

app.UseStaticFiles();