我的登录是部分视图。我将包含tbl_profile 的某些字段的模型传递给部分视图并填充它,然后我将填充的模型传递给 [HttpPost] 部分的 actionresult 并且......但现在我在 [HttpGet] 部分遇到了麻烦。我在这行 cod " * @Html.Action("LogOn","Account")" *. 我的代码:
[HttpGet]
public ActionResult LogOn(string returnUrl)
{
using (var db = new MyContext())
{
var AllFeatureToLog = db.tbl_profile.Select(u => new UsersClass.LogOn { username = u.username, password_User = u.password_User }).ToList();
return PartialView(AllFeatureToLog);
}
}
班级:
public class UsersClass
{
public class LogOn
{
public string username { get; set; }
public string password_User { get; set; }
}
}
登录.cshtml:
@model MyProject.Models.UsersClass.LogOn
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<form class="signin-form">
@Html.TextBoxFor(m => m.username, new { @id = "username", @class = "input-block- level", @placeholder = "* enter username" })
@Html.TextBoxFor(m => m.password_User, new { @id = "password", @class = "input-block-level", @placeholder = "* enter pass" })
@Html.ValidationMessage("LoginError")
<label class="checkbox">
<input type="checkbox">remember me</label>
<button class="btn btn-medium btn-general input-block-level" type="submit"> enter</button>
</form>
}
错误:
Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'