Skip to content

Route Constraints #37727

@Alerinos

Description

@Alerinos

Hi i miss the route management option on blazor server side like it was on mvc or razor pages.
at the moment we can give the following types:
bool, datetime, decimal, double, float, guid, int, logn
Could use more options, e.g. regex
@page "/{culture:regex(^[a-zA-Z]{{2}}(-[a-zA-Z+]{{2}})?$)=pl}";
It would also be useful to define default values when there is empty content

It's also very fun to create your own content as described here.
https://www.learnrazorpages.com/advanced/custom-constraints
This allows us to create SEO friendly links that make it easier for users to enter.

Let me know what you think, I think adding a regex and a default value is a minute. I was able to find something like that.
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Componentsfeature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the future

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions