I am generating an URL in JavaSctipt.
The first time I generate this URL I get the correct URL:
E.g. **http://localhost:54415/NffCall/Details/DK/6607726**
But the next time I generate the link I get the previous link combined with current parameters:
E.g. http://localhost:54415/NffCall/Details/DK/6607726/DK/6608146
The code which genrates my URLs looks like this:
var actionUrlBase = '@Url.Action("Details", "NffCall")';
var actionUrl = actionUrlBase + '/' + countryCode + '/' + orderNumber;
window.location.href = actionUrl;
What shall I do to generate the correct link every time?
EDIT:
I will just paste how the RouteCollection looks like:
routes.MapRoute(
name: "CountryCodeOrderNumberDetails",
url: "{controller}/{action}/{countryCode}/{orderNumber}",
defaults: new { controller = "NffCall", action = "Details", countryCode = (string)null, orderNumber = (int?)null },
constraints: new { countryCode = "[a-zA-Z]{2}", orderNumber = "[0-9]+" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);