Html.BeginForm在IE浏览器中发布HttpGet动作而不是HttpPost,在Chrome和Firefox中很好

Dec*_*lty 7 c# razor asp.net-mvc-3

我的Razor视图中有以下内容:

 @using (Html.BeginForm("Edit", "MyController", FormMethod.Post))
{
    <div class="grid_1">&nbsp;</div>
    <div id="ValSummary"> @Html.ValidationSummary(false)</div>


    @Html.EditorFor(x => x.Role, MVC.Shared.Views.EditorTemplates.KeyValuePairSelectList, new { SelectListOptions = Model.RoleSelectList })<br /><br />
    @Html.EditorFor(x => x.Trust, MVC.Shared.Views.EditorTemplates.KeyValuePairSelectList, new { SelectListOptions = Model.TrustSelectList.OrderBy(x => x.Text) })<br /><br />
    @Html.EditorFor(x => x.GmcCode)<br /><br />


    <div class="createbutton">
        <input id="btnGoBack" type="button" value="Back"/>  
        <input id="btnSubmit" type="button" value="Submit" />
    </div>

}
Run Code Online (Sandbox Code Playgroud)

在我的控制器中我有

[HttpGet]
public virtual ActionResult Edit(string id)
{
}

[HttpPost]
public virtual ActionResult Edit(ViewModel viewModel)
{
}
Run Code Online (Sandbox Code Playgroud)

在Firefox和Chrome中,一切正常,但在IE中提交表单时,HttpGet操作被触发而不是HttpPost.

调用堆栈或IE开发人员工具控制台中没有线索.

我遗失的任何明显的东西?

nem*_*esv 7

您的提交按钮应该真正的提交按钮type="Submit"

<input id="btnSubmit" type="submit" value="Submit" />
Run Code Online (Sandbox Code Playgroud)

在所有浏览器中正确提交表单.

请参阅此SO问题以获得进一步的差异:<input type ='button'/>与<input type ='submit'/>之间的差异