我正在开发一个ASP.NET MVC 4应用程序,其中需要嵌入一个向导。这个向导包含三个屏幕。我需要将它们的URL映射到:
/wizard/step-1
/wizard/step-2
/wizard/step-3
在我的WizardController中,我有以下动作:
public ActionResult Step1()
{
var model = new Step1Model();
return View("~/Views/Wizard/Step1.cshtml", model);
}
[HttpPost]
public ActionResult AddStep1(Step1Model previousModel)
{
var model = new Step2Model();
model.SomeValue = previousModel.SomeValue;
return View("~/Views/Wizard/Step2.cshtml", model);
}
[HttpPost]
public ActionResult AddStep2(Step2Model previousModel)
{
var model = new Step3Model();
return View("~/Views/Wizard/Step3.cshtml", model);
}
虽然这种方法可行,但我的问题是浏览器URL不会更新。我该如何发布来自步骤的值并将用户重定向到具有不同数据模型的新URL?
谢谢!