SHARE
TWEET
Untitled
a guest
Jan 29th, 2018
51
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- <authentication mode="Forms">
- <forms loginUrl="~/account/index" protection="All" timeout="90" name="CUSTOMER_AUTH" path="/" requireSSL="false" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" />
- </authentication>
- [HttpPost]
- public ActionResult Index(string email, string password)
- {
- if (!string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(password))
- {
- var loginQuery = db.Musteri.FirstOrDefault(x => x.Eposta == email && x.Parola == password && x.Durum == true);
- if (loginQuery != null)
- {
- FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, loginQuery.Id.ToString(), DateTime.Now, DateTime.Now.AddMinutes(90), false, loginQuery.Eposta);
- string encryptedTicket = FormsAuthentication.Encrypt(ticket);
- HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
- cookie.Expires = DateTime.Now.AddMinutes(90);
- Response.Cookies.Add(cookie);
- return Redirect("/home");
- }
- }
- ModelState.AddModelError("LoginError", "Hatalı kullanıcı bilgisi");
- return View();
- }
RAW Paste Data

