Attribute routing and MapGroup() #63668
Unanswered
MichalSznajder
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hello @MichalSznajder, app.UseRouting();
app.MapControllers(); // attribute-routed controllers (no group)
app.MapGroup("/Group")
.MapControllerRoute("fixed", "Home/Conventional",
new { controller = "Home", action = "Conventional" }); This keeps attribute-routed actions from inheriting the group prefix |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Let's consider following program:
I have one controller that mixes both conventional (albeit "fixed") and attribute routing.
Could someone give me hints why following works:
Suddenly attribute route is attached to a group. Is there a way to prevent it?
Background: I want to create conventional routing similar to Rails resources and group them with
MapGroup()
. However still I have still some attribute routed controllers and they got attached to various groups.Beta Was this translation helpful? Give feedback.
All reactions