2011-02-08 72 views
0

如何正確地重定向到我的控制器中的其他操作?在下面的代碼中調用redirecttoaction時,代碼不會轉到「Javascript」操作。我錯過了什麼?謝謝!Redirecttoaction不重定向

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

您需要返回:

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

我不好意思:)感謝的人 – Nick

+0

@Nick,沒有什麼不好意思的。我們都會犯錯。 –