© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
53 replies
Cydo

✅ MVC application routing issue.

Why does the following code not work
                        <div>
                            <a asp-route-productId="@product.Id"
                               class="btn btn-primary bg-gradient border-0 form-control">
                                Details
                            </a>
                        </div>
                        <div>
                            <a asp-route-productId="@product.Id"
                               class="btn btn-primary bg-gradient border-0 form-control">
                                Details
                            </a>
                        </div>


But this code does

                        <div>
                            <a href="@Url.Action("Details", "Home", new { productId = product.Id })"
                               class="btn btn-primary bg-gradient border-0 form-control">
                                Details
                            </a>
                        </div>
                        <div>
                            <a href="@Url.Action("Details", "Home", new { productId = product.Id })"
                               class="btn btn-primary bg-gradient border-0 form-control">
                                Details
                            </a>
                        </div>
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

.NET MVC Project Issue
C#CC# / help
17mo ago
MVC model binding issues
C#CC# / help
2y ago
❔ MVC
C#CC# / help
3y ago
Routing issue with ASP.Net Core
C#CC# / help
4y ago
Next page