Imagine, this is the route to my Blazor page: @page "/a/b/c/{numericvalue:int}"
The following requests would match:
/a/b/c/1
/a/b/c/2
/a/b/c/509
This request...
/a/b/c/test
... would display the NotFound page defined in the App.razor file:
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
But now I want odd number to be rejected, too. How can I display the NotFound page manually after I found out that the number is odd? My code looks like this:
@code{
[Parameter]
public int NumericValue {
set => {
if(value % 2 == 1)
// show the 404 page
}
}
}