110,499
社区成员
发帖
与我相关
我的任务
分享
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(Operation.Model.userInfo ui)
{
if (ModelState.IsValid)
{
try
{
Operation.BLL.userInfo uiBLL = new Operation.BLL.userInfo();
ui.pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(ui.pwd, "MD5").ToUpper();
if (uiBLL.Exists(ui))
{
return RedirectToAction("Index", "UserInfo");
}
else
{
return Content("用户名密码错误!");
}
}
catch
{
return View();
}
}
else
{
return View();
}
}
$(document).ready(function () {
/*登陆按钮*/
$('#loginBtn').click(function () {
$.ajax({
url: '/Login/Index',
data: 'string',
type: 'post',
success: function (data) {
alert(data);
}
});
});
/**登陆按钮 END**/
});
@model Operation.Model.userInfo
@using (Html.BeginForm("LoginAction", "Login", null, FormMethod.Post, new { id = "myform", name = "myform" }))
{
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2">
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
</td>
</tr>
<tr>
<td>
用户名:
</td>
<td>
@Html.TextBoxFor(model => model.userName)
</td>
</tr>
<tr>
<td>
<pre>密 码:</pre>
</td>
<td>
@Html.PasswordFor(model => model.pwd)
</td>
</tr>
<tr>
<td></td>
<td>
<input type="image" src="~/Images/loginBtn.gif" id="loginBtn"/>
</td>
</tr>
</table>
}