【问题标题】:Mvc RedirectToAction Is Not Open New .cshtmlMvc RedirectToAction 未打开新的 .cshtml
【发布时间】:2018-04-15 15:36:04
【问题描述】:

我想使用 RedirectToAction 打开新的 .cshtml。但不工作。仓库 ActionFilter 正在打开。但网址不会改变。请帮帮我。

[HttpPost]
public ActionResult Index(string storageid)
{

    return RedirectToAction("Depot",new RouteValueDictionary(new { Controller = "Depot", Action = "Depot", storageId = storageid }));
}


public ActionResult Depot(string storageid)
{

    return View("Depot");
}

【问题讨论】:

    标签: c# asp.net-mvc url-redirection


    【解决方案1】:

    没有看到你的路线定义,我只是使用:

    return RedirectToAction("Depot", "Depot", new { storageid = storageid });
    

    这样更直接,更不容易出错。

    注意:上面使用storageid,而不是RouteValueDictionary中定义的storageId(注意Id中的大写I)-根据ActionResult Depot中的参数定义,它应该是storageid /p>

    【讨论】:

      猜你喜欢
      • 2014-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 2019-09-12
      • 2016-06-12
      • 1970-01-01
      相关资源
      最近更新 更多