I have the following route
routes.MapRoute("CreateBook", "{controller}/{action}/{slug}/{name}", new { controller = "CreateBook", action = "Index" , slug = UrlParameter.Optional, name = UrlParameter.Optional});
For some reason, when I call RedirectToAction, the url is displayed as
return RedirectToAction ("Parameters", new {slug = 1234, name = "helloworld"});
http: // localhost / CreateBook / Parameters? slug = 1234? name = helloworld
I would like
http: // localhost / CreateBook / Parameters / 1234 / helloworld
How do I achieve this?
I assume the call RedirectToActionselects the default route, not your specialized route.
RedirectToAction
By default, when you pass route values, MVC will add values as query parameters.
Have you sent this route to the default route?
Source: https://habr.com/ru/post/1779713/More articles:Transmission type variable when instantiating a class - javaHow can I get the "name" of the starting address of a process, how is this done in Process Explorer? - c ++How to implement `range ()` - javaHow to get Worker () to work with a cross-domain? - html5glTexImage3D crash in QT - qtwe can make some changes to the object returned at runtime - javadrape and quit to reorder - jqueryWhat does this cycle do? - mathWhat happens with jQuery Masonry, when I click back in the browser, it lifts the user back? - javascriptотправка почты из php: заголовки интерпретируются как тело? - phpAll Articles