Open emir3100 opened 2 years ago
endpoints.MapGet("/{culture:regex(^[a-zA-Z]{{2}}(-[a-zA-Z+]{{2}})?$)=pl}/{**rest}", async context =>
{
var culture = context.Request.RouteValues["culture"] ?? _website.Culture;
var rest = context.Request.RouteValues["rest"];
var option = new CookieOptions
{
Expires = DateTime.Now.AddYears(1)
};
context.Response.Cookies.Append("Culture", culture.ToString() ?? "", option);
context.Response.Redirect($"/{rest}", permanent: false);
await Task.CompletedTask;
});
The only thing you can do is redirect the URL to the cookie. Routing in blazor is very weak.
Tracking as part of https://github.com/dotnet/aspnetcore/issues/38121
Reopening so we can independently consider this link generation scenario.
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
Im using blazor server and when I am trying to implement a language url to my website, I run into problems with the router component.
I tried to modify the current router but many of the classes are protected and inaccessible.
https://example.com/home
-->https://example.com/en/home
My desired outcome is to use@page "/home"
on the pages without adding the language code.Describe the solution you'd like
Either implement a feature to easier create language URL with the router component or make it easier to modify the current router.
Additional context
No response