dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.43k stars 10.02k forks source link

Increase@Url.Action function Overload #56204

Open wangyimingok opened 4 months ago

wangyimingok commented 4 months ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe the problem.

I want to limit the page jump path in the MVC View. My project uses the Area domain, but the parameters of the @Url.Action function I call do not have any Area-related parameters, only the parameters of Controler and Action. Can I add an overload to this function? I think there are many scenarios for using Area in MVC projects.

Describe the solution you'd like

Hope to add a @Url.Action function to support Area domain overloading

Additional context

No response

wangyimingok commented 4 months ago

I followed the official documentation: https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/routing?view=aspnetcore-2.2#areas and used the new { Area = "Zebra" } parameter, but the URL I got was incorrect. It should be expected to be like this: http://localhost:{port}/{AreaName}/{ControllerName}/{ActionName}, but the actual URL address is: https://localhost:{Port}/{ControllerName}/{ActionName}?Area={AreaName}