Displaying A Start Page In ASP.NET Core 3.1 Web API Project.

Displaying A Start Page in ASP.NET Core 3.1 Web API project.


When we create a Web API project using Visual Studio 2019 Template there is no file to display when the web application start. That is because Web API doesn't need to display any information to the user or the public. But some times we may need to add a little bit of information to the site, or even during the development stage we may need to show some information.

Add

app.UseDefaultFiles();

app.UseStaticFiles();



to the Configure method in the Startup.cs file.

Then Add a Folder and name it as wwwroot. This is is very important. Then add the Index.html file inside wwwroot folder.

Now we can edit the index.html file to add any information.

That's it.

Comments

Popular posts from this blog

Examining the Project structure - ASP.NET Core 7 Part 4

Getting Familiar with Visual Studio 2022 IDE - ASP.NET Core 7 Part 3