C
C#2y ago
palapapa

❔ What does the "required" constraint do in route templates?

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/routing?view=aspnetcore-7.0#route-templates says the "required" constraint "Used to enforce that a non-parameter value is present during URL generation." I don't know what that means and can't seem to find any information about it.
Routing in ASP.NET Core
Discover how ASP.NET Core routing is responsible for matching HTTP requests and dispatching to executable endpoints.
3 Replies
phaseshift
phaseshift2y ago
it means that something in the url before '?' must be present (parameters being the name/value things after "?")
palapapa
palapapaOP2y ago
But you can just do {name} and it is still required?
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?