Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ActionResult Login()
- {
- return View();
- }
- [HttpPost]
- public ActionResult Login(Panel model, string Username, string Password)
- {
- if (ModelState.IsValid)
- {
- if (model.Username == Username && model.Password == Password)
- {
- FormsAuthentication.SetAuthCookie(model.Username, false);
- return RedirectToAction("Index", "Test");
- }
- else
- {
- ModelState.AddModelError("", "Wrong username or password");
- }
- }
- return View();
- }
- [Authorize]
- public ActionResult Index()
- {
- return View();
- }
- if (model.Username == Username && model.Password == Password)
- [HttpPost]
- public ActionResult Login(Panel model)
- {
- if (ModelState.IsValid)
- {
- if (Membership.ValidateUser(model.Username, model.Password))
- {
- FormsAuthentication.SetAuthCookie(model.Username, false);
- return RedirectToAction("Index", "Test");
- }
- else
- {
- ModelState.AddModelError("", "Wrong username or password");
- }
- }
- return View();
- }
Add Comment
Please, Sign In to add comment