How can you set a default document (like index.html) to be served when the user accesses the root URL in an ASP.NET Core app?

  • Use the app.UseDefaultDocument() method
  • Configure the DefaultDocument property in Startup.cs
  • Add a default.html file to the project
  • Use the app.UseIndexFile() method
To set a default document like index.html to be served when the user accesses the root URL in an ASP.NET Core app, you can configure the DefaultDocument property in Startup.cs. This allows you to specify the default file that should be served when a directory is requested without a specific file name.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *