-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Link is mis-rendering based on the current page #24455
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
Thanks for contacting us. @javiercn do we have a separate issue tracking this? |
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. |
I was able to reproduce this behavior, but I'm not necessarily convinced it's a bug. Route values from the current request are reused in link generation (see https://learn.microsoft.com/aspnet/core/fundamentals/routing?view=aspnetcore-6.0#ambient-values-and-explicit-values), and I think that might apply to this case as well. You can override route values in the link by adding attributes to the @javiercn Does my assessment seem correct that this is by design? |
@MackinnonBuck I always assumed it had been written to behave this way. I would argue that it makes no sense in this case though. |
@SoftCircuits does the |
@MackinnonBuck I don't know what I would specify for This is from 2 1/2 years ago. I don't recall exactly how I worked around it. |
@SoftCircuits if the <a class="dropdown-item" asp-area="Reports" asp-page="/ChangeLogs/Index" asp-route-id="">Change Logs</a>
That's fine! I'm going to close this issue as by-design for now, but we can reopen it if we get more feedback from the community that we should improve this behavior. Thanks! |
I have a Razor Pages application with the following markup in my _Layout.cshtml file.
Notice the last link (to /ChangeLogs/Index). This page has a page route (
@page "{id?}"
).This markup appeared to be rendering correctly. But then I manually navigated to /Reports/ChangeLogs/61, and the markup above rendered as:
Notice the route value of the current page was appended to that last link. Somehow, the fact that the current page is /Reports/ChangeLogs/61, is causing the link in the menu to render with this route value!
I can't explain this. And I need to stop it from happening.
Further technical details
.NET Core SDK (reflecting any global.json):
Version: 3.1.302
Commit: 41faccf259
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.302\
Host (useful for support):
Version: 3.1.6
Commit: 3acd9b0cd1
.NET Core SDKs installed:
3.1.302 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
The text was updated successfully, but these errors were encountered: