In my Controller, I have 4 ActionResult (Show, Search, Modify and Delete) for the View. For the 3 last, there are a RedirectToAction() as Actionesult and in Route I have a custom as this :
routes.RouteMap("Detail", "/Show/{id}", new { controller : "Administration", action : "Show", id : UrlParameters.Optional });
I need to add 2 parameters in url when I get the result of Search. This 2 parameters are sent in POST. How to add this parameters in url rewritting as is ?
When I come on the View
http://localhost/Show/1
After a Search
http://localhost/Show/1/foo/foo
Thanks for helping :)
[EDIT] After some test, I found the solution. Forms and Controller are in POST unless the Show (GET | POST).
There is 2 routes :
routes.MapRoute(
"RechercheEtablissementGucps",
"DetailGucps/{idGucps}/{CategorieEtablissementValue}/{SearchField}",
new { controller = "Administration", action = "AfficheDetailGuCPS", idGucps = UrlParameter.Optional, CategorieEtablissementValue = UrlParameter.Optional, SearchField = UrlParameter.Optional }
);
routes.MapRoute(
"Gucps", // Route name
"DetailGucps/{idGucps}", // URL with parameters
new { controller = "Administration", action = "AfficheDetailGuCPS", idGucps = UrlParameter.Optional } // Parameter defaults
);
I have then the parameters as desired if I search and nothing if another Action is done
/DetailGucps/29/DIR/fr