0
我在我的项目中使用MVC5路由属性。MVC5属性路由不起作用
我在主页上有搜索控件。当用户点击搜索按钮时,控制值将被传递给搜索控制器操作。
使用MVC5路由属性URL之前http://localhost:5344/Search/View1?City=XYZ&Cat=ABC
首页控制器代码:
public ActionResult IndexFront(string City, string Search, string hidCategory, string btnSubmit)
{
return RedirectToAction("View1", "Search", new { CityS = City, SearchS = Search, Cat = hidCategory });
}
搜索控制器代码:
[Route("Search/{CatS}/{CityS}/{SearchS?}", Name="SearchWithCityCat")]
public ActionResult View1(string CityS, string SearchS, string CatS)
{
var searchModel = new SearchModel();
return View(searchModel);
}
与路由属性装潢视图1,然后点击搜索按钮,它之后显示相同的URL并给出错误“找不到页面”。
我没有找到解决这个问题的方法。
我做得对吗?
请帮忙。提前致谢。
尝试'返回RedirectToAction(“SearchWithCityCat”,“搜索”,' – artm 2014-10-31 07:51:39