为什么MapPageRoute会破坏Html.Beginform操作

时间:2016-07-15 15:18:53

标签: html5 asp.net-mvc-4

有人可以帮我弄清楚我做错了什么吗?我的html扩展方法声明如下

@using (Html.BeginForm("SomeMethod", "MotorcycleForSale", FormMethod.Get, new { id = "frmBrokers" }))
{
    <input type="hidden" id="BrokerId" name="BrokerId" />
}

它称为预期路线

但后来我添加了

routes.MapPageRoute
            routes.MapPageRoute("HomeDef", "Home/Default", "~/WebForms/Default.aspx");

当我启动Web应用程序时,它会覆盖表单操作,如下所示

<form id="frmBrokers" action="/Home/Default?action=SomeMethod&amp;controller=MotorcycleForSale" method="get">    <input name="BrokerId" id="BrokerId" type="hidden">

1 个答案:

答案 0 :(得分:0)

仅供参考:我最好能搞清楚它在MVC中的一个错误。我退出使用html扩展方法,切换到普通的旧HTML,一切正常。