-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change ASP.NET Core Razor pages Default page #9729
Comments
I have the same issue. I delete the |
Thank you for your feedback. |
Sometimes I cannot help but think that MS employees intend to fit the stereotype. (You know the joke with the technically true but useless response.) The only thing I can see on that page is the "configure a page route" section, which shows the exact example that the OP says is not working. Was it so difficult to explain exactly how to do what's being asked, instead of pointing to a long and complex page? |
@mdpopescu I've put together a sample showing how to do this: https://github.com/mkArtakMSFT/Samples/blob/master/CustomPageRouteConvention/Conventions/DefaultRouteRemovalPageRouteModelConvention.cs Hope this helps. |
Thank you, much appreciated. |
For ASP.NET Core MVC , we could get it easily by changing the route in
app.UseMvc()
.For Razor pages , MVC routing does not apply since Razor pages uses a different routing setup .But an error is generated when I tried to configure it using the
AddRazorPagesOptions
extension method toAddMvc
like below:What the error is show
If I remove or rename “Pages/Index.cshtml” , it worked . But this workaround seems to be not reasonable. I wonder whether there is any other methods to change Razor pages Default page without changing the original one.
The text was updated successfully, but these errors were encountered: