Umbraco + mvc页面重定向数据

时间:2016-01-27 06:58:30

标签: asp.net-mvc webforms umbraco umbraco6

我想用模型数据重定向到其他Umbraco页面。

目前我只是重定向到其他Umbraco页面而不是模型数据。

 public ActionResult CNOReplacement(MasterViewModel Model)
        {
            ViewBag.TestData = "Testing ViewBag data passing !!";
            return RedirectToUmbracoPage(1098);   
        }

即使我已经通过传递viewmodel尝试过,但这也无效。

2 个答案:

答案 0 :(得分:1)

我没有得到任何解决方案,但是使用另一种方式完成了这项工作,

我已经使用HttpContext会话变量来获取每个Umbraco页面上的数据。

在控制器操作中,我创建了一个会话

Session["MasterViewModel"]=new MasterViewModel();

使用以下代码重定向到其他Umbraco页面时:

public ActionResult CNOReplacement(MasterViewModel Model)
        {
            return RedirectToUmbracoPage(1098);   
        }

在View中,我们将会话变量设为::

@inherits Proj.ViewModel.MasterViewModel
@{var PerviousPageModel= Session["MasterViewModel"] as MasterViewModel}

答案 1 :(得分:0)

[HttpGet]
public ActionResult AAA()
{
GameModel model = new GameModel() { Id = 10 };
return RedirectToAction("BBB", "Game", model);
}

public ActionResult BBB(GameModel model)
{
return View(); {
{1}} {
{3}}>