重定向操作不是重定向

时间:2011-02-08 20:11:03

标签: asp.net-mvc

如何正确地重定向到控制器中的其他操作?当在下面的代码中调用redirecttoaction时,代码不会分支到“Javascript”操作。我错过了什么?谢谢!

  public ActionResult Build(
        string uid,
        string release,
        string localization,
        string label,
        string sessionid,
        FormCollection formCollection)
    {
        if (!FormValid(uid, release)) return Index();

        if (formCollection["sxgenre"] == "Mobile")
        {
            RedirectToAction("Javascript",
                             new
                                 {
                                     uid = uid,
                                     release = release,
                                     localization = localization,
                                     label = label,
                                     sessionid = sessionid
                                 });
        }

1 个答案:

答案 0 :(得分:1)

你需要回复:

if (formCollection["sxgenre"] == "Mobile")
{
    return RedirectToAction(
        "Javascript",
        new
        {
            uid = uid,
            release = release,
            localization = localization,
            label = label,
            sessionid = sessionid
        });
}