【发布时间】:2013-01-21 07:25:50
【问题描述】:
我编写了 ASP.NET MVC 应用程序,我发现了一件有趣的事情。当我在 View 中使用时:
@using (Html.BeginForm("Login", "Home", FormMethod.Post))
调用了 HomeController 类的方法 Login。但是如果我把这个 html 写到 View 中:
<form action="@Url.Action("Login", "Home")" method="post">
(表单动作导致同一个控制器的相同动作)它是索引动作而不是调用。为什么? 在这两种情况下,都会呈现以下相同的 html:
<form action="/Home/Login" method="post">
谢谢
【问题讨论】:
标签: asp.net-mvc-3 view-helpers