我有一個MVC項目巫婆默認映射whcih我改成:MVC映射 - RedirectToAction不工作
routes.MapRoute("Default", "{controller}/{id}/{action}/{arg}",
new { controller = "Home", action = "Index",
id = UrlParameter.Optional, arg = UrlParameter.Optional }
);
以下控制器:
/Controllers/HomeController.cs:
public ActionResult Index(int? id)
{
return RedirectToAction("Index", "EPOS");
}
/Controllers/EPOSController.cs:
public ActionResult Index(int? id)
{
return View();
}
斷點被擊中HomeController的,但在EPOSController
不打,我得到這個錯誤:
No route in the route table matches the supplied values.
我在做什麼錯?
用於產生什麼網址:返回RedirectToAction(「指數」, 「EPOS」); – epignosisx
在瀏覽器「http:// localhost:1096 /' – gunwin
中顯示錯誤時,請使用'RedirectToAction(」Index「,」EPOS「,null);'嘗試使用URL。讓我知道這是否會改變結果。 – 2012-01-26 20:46:05