How to change starting page, using Razor Pages in .NET Core 2?

后端 未结 4 1438
我寻月下人不归
我寻月下人不归 2020-12-20 13:37

I wanted to set my starting page to /Members/Index.

When I was using MVC, I configured it as following:

app.UseMvc(routes =>
            {
              


        
4条回答
  •  不思量自难忘°
    2020-12-20 13:48

    Add the following to your ConfigurationServices function in Startup.cs

     services.AddMvc().AddRazorPagesOptions(options =>
            {
                options.Conventions.AddPageRoute("/Members/Index", "");
            });
    

    If you have another index page you'll probably need to delete or rename it.

提交回复
热议问题