Razor is an ASP.NET programming syntax used to create dynamic web pages with the C# or VB.NET programming languages. Razor was in development in June 2010 and was released for Microsoft Visual Studio 2010 in January 2011
Nowadays Razor pages are very popular in the developer community. In this article, I will show you how to configure custom default page in .NET Razor page application.
Let’s suppose you want to open the Home/Index
page as a landing page for your application.
Open Startup.cs
file and add the following code snippet.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddRazorPagesOptions(options =>
{
options.Conventions.AddPageRoute("/Home/Index", "");
});
}