dotnet / dotnet/aspnetcore

asp-all-route-data value should not be changed

Open
#57,701 0 comments 2 reactions 0 assignees View on GitHub
area-mvc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

When generating multiple links using shared dictionary as `asp-all-route-data` parameter value, the dictionary will be changed if there are some other `asp-route-*=` parameters.
this will cause unexpected link query string in the following anchors.

refer: https://github.com/dotnet/AspNetCore.Docs/discussions/28333

### Expected Behavior

parameter provied to `asp-all-route-data` should not be changed, as the purpose of `asp-all-route-data` is for share link query parameters.

### Steps To Reproduce

There are some links to change sorting, using `order`.
```

Recent updated


Most used

```

And there are other links for change pagging will have wrong `order` parameter.
Exprected `order` value is the value in curent url query string,
Actual `order` value will be the last `asp-route-order` value in previoues tags.

```



  • 首页


  • 上一页

  • @for (int i = Model.CurrPage.GetBeginPageIndex(); i < Model.CurrPage; i++)
    {

  • @i

  • }

  • @Model.CurrPage

  • @for (int i = Model.CurrPage + 1; i < Model.CurrPage.GetEndPageIndex(Model.PageCount); i++)
    {

  • @i

  • }

    @if (Model.HasMore)
    {


  • 下一页


  • 末页

  • }


```

### Exceptions (if any)

_No response_

### .NET Version

8

### Anything else?

all asp.net core versions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.