Does the @Url.Action method return the current URL if the user is already on the controller and action specified in the parameters?
I have a straightforward setup for our controllers.
OrderableTest/Details/Id
ResultableTest/Details/Id
When I use
@Url.Action("Details", "Orderable")
from either the home controller (Home/Index)
or from the Resultable/Details
page, it correctly saves the URL to a JavaScript variable as "/Orderable/Details"
. However, if I am already on a Details page where the id is included in the URL, such as Orderable/Details/12345
, calling @Url.Action("Details", "Orderable")
results in "/Orderable/Details/12345"
. Is this the intended behavior?
The routing map is set to default.
Here is the requested Javascript:
var orderableDetailUrl = '@Url.Action("Details", "Orderable")';
var resultableDetailUrl = '@Url.Action("Details", "Resultable")';
alert(orderableDetailUrl);
alert(resultableDetailUrl);