1
votes

Further Information added below

When using the following "RedirectToAction" (which produces the following URL) I get:

**The view 'searchterm' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/browse/searchterm.aspx
~/Views/browse/searchterm.ascx
~/Views/Shared/searchterm.aspx
~/Views/Shared/searchterm.ascx
~/Views/browse/searchterm.cshtml
~/Views/browse/searchterm.vbhtml
~/Views/Shared/searchterm.cshtml
~/Views/Shared/searchterm.vbhtml**

Action generating the request:

public ActionResult Action(string id)
{
    if (!(string.IsNullOrEmpty(id)))
    {
        string SearchTerm = id;
        return RedirectToAction("Products", new { SearchString = SearchTerm, Layout = "Row" });
    }
    return View();
}

URL:http://localhost:52006/browse/Products?SearchString=searchterm&Layout=Row

RouteConfig:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
       "Default", // Route name
       "{controller}/{action}/{id}", // URL with parameters
       new { controller = "Home", action = "Index", id = "" });

    routes.MapRoute(
       "Admin", // Route name
       "Admin/{controller}/{action}/{id}", // URL with parameters
       new { controller = "Dashboard", action = "Index", id = "" });
}

Products Controller: public ActionResult Products(string SearchString, string Layout = "Grid") { ViewBag.Layout = Layout; return View(SearchString); }

further information

urls that end up going through the "products" action and being processed:

http://localhost:52006/Browse/Products?Layout=Row#

urls that end up looking for an action with name = SearchString:

http://localhost:52006/Browse/Products?Search=acolyte&Layout=Row - interesting because it shows that the order of the parameters is not throwing the routing off/ it isn't just grabbing the first parameter as the action to look for.

http://localhost:52006/Browse/Products?Layout=Row&Search=acolyte
1
have you tried to use redirect base_url();?aiai
I don't understand? Can you give an example.HarborneD
instead of return RedirectAction use this "return redirect(base_url('path_to_redirect'));"aiai
"redirect" doesn't exist?HarborneD
there's also no reason why redirecttoaction doesn't work here.... but for soe reason it ends up looking for a view with a name = SearchStringHarborneD

1 Answers

-1
votes

through a combination of checking all routes included their areas and the route registration for the areas were correct i fixed this issue.