62,040
社区成员
发帖
与我相关
我的任务
分享
public ActionResult Login()
{
return View();
}
[HttpPost]
public ActionResult Login(string name, string pwd)
{
myComputerDataContext db = new myComputerDataContext();
name = Request.Form["username"];
pwd = Request.Form["userpwd"];
var q = from o in db.UserTable
where o.UserName == name && o.UserPwd == pwd
select o;
if (q.Count()>0)
{
FormsAuthentication.SetAuthCookie(name, true);
Session["CurrentUser"] = name;
ViewData["Currentuser"] = name;
if (q.First().Flag==1)
{
return RedirectToAction("Index", "Product");
}
else
{
return RedirectToAction("NewsXinGai", "News");
}
}
return View();
}