Advertisement
Guest User

Untitled

a guest
Nov 1st, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public ActionResult Login(LoginViewModel Model)
  2. {
  3. if (ModelState.IsValid)
  4. {
  5. if (Model.UserName == "Waail" && Model.Password == "1234")
  6. {
  7. FormsAuthentication.SetAuthCookie(Model.UserName, false);
  8. Session["UserName"] = Model.UserName;
  9. /*when this is set to false the mvc will
  10. destroy the cookie after the browser is closed otherwise the username is authenticated*/
  11. return RedirectToAction("Index","Home");
  12. }
  13. }
  14. return View();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement