1

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
6
  • have you tried to use redirect base_url();? Commented Jun 12, 2015 at 6:19
  • I don't understand? Can you give an example. Commented Jun 12, 2015 at 7:16
  • instead of return RedirectAction use this "return redirect(base_url('path_to_redirect'));" Commented Jun 12, 2015 at 7:42
  • "redirect" doesn't exist? Commented Jun 13, 2015 at 10:54
  • 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 = SearchString Commented Jun 13, 2015 at 10:55

1 Answer 1

-1

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

Sign up to request clarification or add additional context in comments.

3 Comments

It would be helpful if you explained what you did to answer this question, as in what code you created to make this happen, how you fixed your original problem, etc, etc.
If i'm honest i don't really remember , it was a while a go and i was hoping that closing some open questions mght permit me to ask questions again.
Yeah, I get it, the issue is that your answer appeared in another queue for possible "low quality answers" due to you answering an old question, so, the problem is that by answering your own question with a very undetailed answer, you now put yourself in a predicament of sorts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.