将保持这种简单的可能: -在返回查看ASP.Net MVC表单操作
我有一个有一个控制器,将返回ViewA或ViewB - 例如
[HttpPost]
public ActionResult ViewA(BlahModel model)
{
if (isTrue)
return View(model);
else
return View("ViewB", model);
}
...
我的问题是,ViewB上有一个形式。然后会发生什么,如果它返回,标签的action属性仍指向ViewA。
/MyControllerName/ViewA
我想我可以做这样的事情:
using (Html.BeginForm("ViewB","MyControllerName"))
但这返回标记以下网址:
/ViewB?action=ViewB&controller=MyControllerName
我怎样才能获得HTML辅助正确返回下列?
/MyControllerName/ViewB
非常感谢
UPDATE
这确实是由一些丑陋的传统从何时该项目是WebForms和MVC之间的中途路由造成
什么HTML在ViewB中呈现? ViewB中的表单是否具有action =“get” – 2010-09-23 14:54:26
“<%= Url.Action(”ViewB“,”MyControllerName“)%>'generate? – Charlino 2010-09-23 17:09:47