【发布时间】:2015-07-15 20:48:40
【问题描述】:
我有以下简单的Login-View:(只贴了相关部分)
@model Models.LoginModel
@using (@Html.BeginForm("Login", "Account", FormMethod.Post, new { @enctype = "multipart/form-data", @class = "fm", @ReturnUrl = @ViewBag.ReturnUrl }))
{
@Html.AntiForgeryToken()
<h1 id="title-header">Login</h1>
<div>
@Html.TextBoxFor(m => m.Username, new { @maxlength = "250", @class = "username", @style = "width: 250px;" })
@Html.ValidationMessageFor(m => m.Username)
</div>
<div>
@Html.PasswordFor(m => m.Password, new { @maxlength = "250", @class = "password", @style = "width: 250px;" })
@Html.ValidationMessageFor(m => m.Password)
</div>
<div>
<input type="submit" value="Login" />
@Html.ActionLink("Reset PW","ResetPw","Account", new { model=Model})
</div>
</div>
}
当我提交表单时,一切都很好:调用 Login-Action 并且模型包含用户名和密码。
当我点击“重置密码” - 链接时,我想实现相同但使用不同的操作。该动作被按需调用(“ResetPw()”),但模型不包含用户输入的用户名,但模型的每个字符串属性为空。
【问题讨论】:
-
您是要链接到重置密码页面还是要提交重置密码表单?
标签: asp.net-mvc