fork download
  1. class JsonResultE { public string Result { get; set; } }
  2.  
  3. [HttpPost]
  4. public ActionResult Auth(Models.AuthForm data)
  5. {
  6. if (ModelState.IsValid)
  7. {
  8. userdata userdata = null;
  9.  
  10. try
  11. {
  12. userdata = db.userdatas.Single(u => u.login == data.Login);
  13. }
  14. catch { }
  15.  
  16. if (userdata == null)
  17. {
  18. return Json(new JsonResultE { Result = "failed" }, JsonRequestBehavior.AllowGet);
  19. }
  20. else
  21. {
  22. var cookie = new HttpCookie("session-id") { Value = Guid.NewGuid().ToString(), Expires = DateTime.Now.AddMinutes(10) };
  23. Response.SetCookie(cookie);
  24. return RedirectToAction("", "Default1");
  25. }
  26. }
  27.  
  28. return View();
  29. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty