MVC 2 RC RedirectToAction woes
Posted
by JonathanTien
on Stack Overflow
See other posts from Stack Overflow
or by JonathanTien
Published on 2010-02-25T15:51:33Z
Indexed on
2010/03/22
16:41 UTC
Read the original article
Hit count: 511
Hiya!
I have setup a custom route as defined in my global.asax:
routes.MapRoute(
"Search", "{controller}/{action}/{type}/{searchterm}",
new { controller = "Search", action = "Results", type = "", searchterm = "" }
);
Now all I want to do it in a controller when data is passed via POST basically go in the format:
http://localhost/Search/Results/2/RG12%201JD
Instead what happens is:
http://localhost/Search/Results?type=1&searchterm=RG12%201JD
What am I doing wrong, the offending code is:
return RedirectToAction("Results",new {type = "1", searchterm = "RG12%201JD" });
Any help would be greatly appreciated!
Thanks
Jonathan
© Stack Overflow or respective owner