Join Class

wwwroot directory in Core

"wwwwroot" folder in core is for all static files like css, images, javascript etc.

When we create any Asp.Net Core project, the wwwroot folder is created by default, this folder is basically for all types of static files like html, css, js, images etc.

Any other type of ASP.NET applications we can store any static files in root, or in any other folder under root, and can be served from there. This has been changed in ASP.NET Core. Now we can store any static files under wwwroot folder only, all other files are blocked on http request.

what is wwwroot folder in core?

Here is how the “wwwroot” folder will appear in solution.

wwwroot folder in core

As you can see in above picture, when we created the project a wwwroot folder was added automatically, now when we wanted add one static html file in project.

So for some experiment we have added two files in to two different locations.

  • one under wwwroot=>html=>policy.html
  • application root => test.html

Now let's try to access both the files from your virtual folder by accessing following path

    the above url works fine
    the above url won't work
    above url also won't work

So, hope you understood the use of wwwroot folder, any type of static file that you want to be served on browser, to be placed under wwwroot only. Core Course
wwwroot directory in ASP.NET Core Core Tutorial for Beginners
ASP.NET MVC Interview Questions Answers
Hire .Net Developer
Asp.Net Core C# Examples | Join Asp.Net MVC Course