how to edit the razor pages url?

mc 3,641 Reputation points
2023-03-16T00:36:38.28+00:00

I have razpr pages :ProductEidt

and its url will be http://localhost/ProductEdit?id=1

can i change the@page directive to use the url like http://localhost/p-e-1 ?

ProductEidt to p-e and the parameter is 1

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,158 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,253 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SurferOnWww 1,906 Reputation points
    2023-03-16T02:52:12.5066667+00:00

    Can the following article help?

    How to Use Routing in ASP.NET Core 3.0 Razor Pages

    See the section titled "Route Templates and Segments."

    0 comments No comments