Razor Pages Default Page in aspnetcore 2

前端 未结 5 504
感动是毒
感动是毒 2021-01-11 19:51

By default a Razor Page app goes to Home/Index

Is there a way to change this to Home/App?

This is quite easy in MVC, but Razor pages using a different routing

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-11 20:40

    Pretty sure it isn't possible. The docs say the runtime controls the search for Index as the default. I couldn't find where that happens in the current release, but IndexFileName is a static in the new internal PageRouteModelFactory class added to the upcoming release:

    private static readonly string IndexFileName = "Index" + RazorViewEngine.ViewExtension;

    It doesn't seem like it would be difficult to just add a config property to RazorPagesOptions, though. The ASP.NET guys are pretty responsive, I'd open a request as a GitHub issue and hope for the best.

提交回复
热议问题