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.
Loading...
Related Quiz
- Before the introduction of .csproj in .NET Core 2.0 and later, which file was used to define the project configuration?
- You have a page in your application that should be accessible to both authenticated and non-authenticated users. How do you configure this in ASP.NET Core?
- For command-line operations in ASP.NET Core development, the _________ is an indispensable tool.
- What is ASP.NET Core primarily used for?
- The process of mapping an incoming request to a route template is known as _______.