-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Generating URLs for a different action on the same controller reuses ambient values #18400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@danports thanks for contacting us.
I think this has to do with the fact that you are specifying the details. If you remove the |
Removing |
@rynowak can you please look into this? Thanks! |
Any updates on this? Would be helpful to know if what I'm seeing is the expected/desired behavior or a bug. |
Alright, I dug through the code until I found the bits that do ambient value invalidation and I think the code is behaving as designed, though the documentation for ambient value invalidation is a bit confusing. I think the intent of the algorithm is to keep things DRY by avoiding the need to specify every route value for every link, which means that cases like this where you don't want ambient values to be inherited require a bit more work. Including To sum up then, a couple of suggestions:
|
Thanks for contacting us. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Thanks for contacting us. We're moving this issue to the |
The documentation states that "In ASP.NET Core 2.2 or later, both [conventional and attribute] routing invalidate [ambient] values when linking to another action." However, this only seems to be the case for actions on another controller. I am unsure whether this is a bug or the expected behavior with unclear or incorrect documentation.
Repro: Run this sample project, click the Orders tab in the navigation bar, select an order from the list, and then observe that the URL for the Orders tab in the navigation bar as generated on the order details page is
/Orders/5/Index
rather than the expected/Orders
(since the documentation says the ambient value forid
shouldn't be reused since this is a different action). Note also that the Home and Privacy navigation links on the order details page do not reuse ambient values and do not includeid
in their URLs.The text was updated successfully, but these errors were encountered: