7
7
7nbsp2020-12-10 18:33:34
ASP.NET
7nbsp, 2020-12-10 18:33:34

Using DynamicRouteValueTransformer in ASP.NET Core?

I want to use dynamic routes: example.com/yutsuken

I did this

app.UseEndpoints(endpoints =>
{
    endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
    endpoints.MapDynamicControllerRoute<SeoTransformer>("{**path}");
});


There are a few issues that need to be fixed:
1. My SeoTransformer is called when existing routes are called, eg /Home/Index
2. My SeoTransformer is called every time /wwwroot is called, eg when a client requests .js / .css files.

In the transformer, with each call, the desired route is searched, which has a bad effect on performance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-12-10
@firedragon

Something tells me
That this will help you
https://docs.microsoft.com/ru-ru/dotnet/api/system...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question