MVC .NET Core Default Start Page


InterServer Web Hosting and VPS
Sony Playstation PS4 Pro Custom Build NVMe SSD Drive - Enclosure case and Crucial NVMe SSD
PS4 Pro Custom External SSD NVMe Drive

How I built a PS4 Pro Custom External SSD NVMe Drive...

NUC8i7BEH with memory
Intel NUC8I7BEH Review and Custom Build

This is my review of the Intel NUC8i7BEH and a summary of my build...

Card image cap
Asus M5A88-M EVO Review

This is my review of the Asus M5A88-M EVO motherboard...

Corsair Vengeance Blue 8GB (2x4GB) DDR3 PC3-12800C9 1600MHz Dual Channel Kit
Corsair Vengeance Blue Review

This is my review of the Corsair Vengeance Blue 8GB (2x4GB) DDR3 PC3-12800C9 1600MHz Dual Channel Kit memory...

Robotic Arm with USB PC Interface Review
Robotic Arm with USB PC Interface Review

This is my review of the Robotic Arm with USB PC Interface...

MVC .NET Core Default Start Page

Here we look at setting the MVC .NET Core Default Start Page.

I wanted to set the default startup page of an MVC .NET Core website to be something other than the root, in fact I wanted the startup page to be a static HTML file.

Setting the MVC .NET Core Default Start Page to a HTML file

In order to set the startup file to a HTML file in .NET Core 3.1 I had to do the following in Startup.cs:

app.UseDefaultFiles

We use app.UseDefaultFiles(new DefaultFilesOptions to specify the default startup file for the application. In the example below we are setting Index.html to be the startup page when our MVC .Net Core application starts up.


     app.UseHttpsRedirection();

     app.UseDefaultFiles(new DefaultFilesOptions
     {
         DefaultFileNames = new List { "index.html" }
     });


     app.UseStaticFiles();

     app.UseRouting();

Sponsored Links
SolarSystem - AngularJS Demo
SolarSystem - Angular JS Demo

Check out my first Angular JS demo hosted in Azure, it helped win my first Angular contract. Put the sound on.