Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ActionResult Login(LoginViewModel Model)
- {
- if (ModelState.IsValid)
- {
- if (Model.UserName == "Waail" && Model.Password == "1234")
- {
- FormsAuthentication.SetAuthCookie(Model.UserName, false);
- Session["UserName"] = Model.UserName;
- /*when this is set to false the mvc will
- destroy the cookie after the browser is closed otherwise the username is authenticated*/
- return RedirectToAction("Index","Home");
- }
- }
- return View();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement