I have problem using redirect to another action. here is what I send from my View:
@using(Html.BeginForm("redirect","Home",FormMethod.Get,new { id="Indexform",name="Myform" }))
{<input type="hidden" name="id" value="1" />}
And here is controller:
public ActionResult redirect(string id = ""){
return RedirectToAction("MainSearch","Home",new
{
My_Categories = id,
Area = "New England"
});
}
and the target action is MainSearch in Home Controller:
public ActionResult MainSearch(string My_Categories = "", string Area="Wales"){
ViewBag.Area=Area;
ViewBag.Category=My_Categories;
return View();
}
My Routing Configuration is as following:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Priosa",action = "Huvudmeny",id = UrlParameter.Optional }
);
}
Why do I get this error:
No route in the route table matches the supplied values.
MainSearch()
method