Asp.net mvc 3 MVC 3表格发行

Asp.net mvc 3 MVC 3表格发行,asp.net-mvc-3,Asp.net Mvc 3,我刚刚将我的应用程序从MVC2迁移到MVC3 我发现每当我的登录页面被加载时,Action属性都保持为空白 代码如下: <% using (Html.BeginForm("ValidateUser", "Account", FormMethod.Post, new { id = "formLogin", name = "formLogin" })) { %>; ........ <%}%>; ; ........ ; 在浏览器中,它显示如下所示: <

我刚刚将我的应用程序从MVC2迁移到MVC3

我发现每当我的登录页面被加载时,Action属性都保持为空白

代码如下:

<% using (Html.BeginForm("ValidateUser", "Account", FormMethod.Post, new { id = "formLogin", name = "formLogin" }))
   { %>;

  ........

<%}%>;
;
........
;
在浏览器中,它显示如下所示:

<form name="formLogin" method="post" id="formLogin" action="">

........


</form>

........
其中操作为空

请帮我解决这个问题

谢谢


Manoj

在Global.asax.cs中是否有默认路由?BeginForm使用UrlHelper.GenerateUrl将操作/控制器名称与路由集合匹配。因此,如果您没有映射到ValidateUser的路由,那么它就无法为其生成URL

在Global.asax.cs中是否有默认路由?BeginForm使用UrlHelper.GenerateUrl将操作/控制器名称与路由集合匹配。因此,如果您没有映射到ValidateUser的路由,那么它就无法为其生成URL

也许你需要这样写:

@using (Html.BeginForm((string)ViewBag.FormAction, "Home", FormMethod.Post, new { id="myform"}))
  {
      some code here
  }

也许你需要这样写:

@using (Html.BeginForm((string)ViewBag.FormAction, "Home", FormMethod.Post, new { id="myform"}))
  {
      some code here
  }

你能显示你的路由定义吗?你能显示你的路由定义吗?