【问题标题】:Mvc Passing data "RedirectToAction" without using Temp dataMvc 在不使用 Temp 数据的情况下传递数据“RedirectToAction”
【发布时间】:2014-06-26 10:17:40
【问题描述】:

如何在不使用 TemptData 的情况下重定向到另一个操作时传递模型数据,如示例中所示。 是否有另一种方法可以在不使用 TempData/Session 的情况下将 EmployeeViewModel 从“AddEmployee”操作传递到“Preview”操作?

public ActionResult AddEmployee(EmployeeViewModel employeeViewModel)
{
  TempData["employee"] = employeeViewModel;
  return this.RedirectToAction("Preview");
}

public ActionResult Preview()
{
  var model = TempData["employee"] as EmployeeViewModel;
  return this.View("Preview", employeeViewModel);
}

【问题讨论】:

标签: asp.net-mvc tempdata


【解决方案1】:

检查一下

return RedirectToAction("Index", new { exception = EmployeeViewModel});

【讨论】:

    猜你喜欢
    • 2010-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多