Attribute routing is not dynamic as attributes are static. Just use standard map route, and load from database. I’d probably upgrade to 3.1 and use endpoint routes.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
None
0 Points
3 Posts
Dynamic routing problem
Apr 22, 2020 09:39 PM|ob7|LINK
I'm developing a multilingual website. I read menus from db
E.g : Contact - en
Kommunikation - de
I have contactController.cs
[Route(“{LangCode}/contact”)]
[Route(“{LangCode}/kammunikation”)]
..............Task Index()
return View()
I dont want this usage.
If i have 5 language, I read menu names from table
And create dynamic routes and redirect contactconroller
I use .net core 2.2
All-Star
58484 Points
15803 Posts
Re: Dynamic routing problem
Apr 22, 2020 11:46 PM|bruce (sqlwork.com)|LINK
Attribute routing is not dynamic as attributes are static. Just use standard map route, and load from database. I’d probably upgrade to 3.1 and use endpoint routes.
Contributor
2720 Points
874 Posts
Re: Dynamic routing problem
Apr 23, 2020 09:32 AM|Rena Ni|LINK
Hi ob7,
What does the `Contact` and `Kommunikation` represent?
For using dynamic routing,you need refer to:
https://www.strathweb.com/2019/08/dynamic-controller-routing-in-asp-net-core-3-0/
Best Regards,
Rena