By default, the Razor Page application goes to Home / Index
Is there any way to change this on the Home / App?
This is fairly simple in MVC, but Razor pages using a different routing setting and thus MVC routing are not applied.
I would think that it will be somewhere in the settings, but I do not see this:
services.AddMvc()
.AddRazorPagesOptions(options =>
{
options.Conventions.AuthorizeFolder("/Account/Manage");
options.Conventions.AuthorizePage("/Account/Logout");
options. ??SetDefaultPage??
});
I tried this:
options.Conventions.AddPageRoute("/App", "");
But now two default routes are found and an error is generated:
AmbiguousActionException: several actions are performed. The following actions were consistent with route data and met all restrictions:
Page: / App
Page: / Index
You can resolve this error by deleting Pages / Index.cshtml from the project, but I also wanted to save this page.
source
share