[英]How do I return a method paramenter with RedirectToAction
我目前有兩個方法簽名。
public ActionResult Edit(bool? failed)
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Update(FormCollection collection)
在更新方法中,當密碼更新失敗時,我想返回失敗== true的“編輯”操作。 但是使用線
return RedirectToAction("Edit", true);
似乎沒有實現這一目標。 (我的確結束於“編輯操作”,但bool值為null。)如何將我重定向到某個操作並仍然保持bool值?
謝謝
您接近-試試這個:
return RedirectToAction("Edit", new { failed = true });
恐怕RedirectToAction並不那么簡單...您需要將參數作為路由值字典傳遞。 嘗試:
return RedirectToAction("Edit", new { failed = true });
請參閱http://msdn.microsoft.com/zh-cn/library/system.web.mvc.controller.redirecttoaction.aspx
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.