daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Jan 29th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <authentication mode="Forms">
  2.   <forms loginUrl="~/account/index" protection="All" timeout="90" name="CUSTOMER_AUTH" path="/" requireSSL="false" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" />
  3. </authentication>
  4.    
  5. [HttpPost]
  6. public ActionResult Index(string email, string password)
  7. {
  8. if (!string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(password))
  9.         {
  10.             var loginQuery = db.Musteri.FirstOrDefault(x => x.Eposta == email && x.Parola == password && x.Durum == true);
  11.             if (loginQuery != null)
  12.             {
  13.                 FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, loginQuery.Id.ToString(), DateTime.Now, DateTime.Now.AddMinutes(90), false, loginQuery.Eposta);
  14.                 string encryptedTicket = FormsAuthentication.Encrypt(ticket);
  15.                 HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
  16.                 cookie.Expires = DateTime.Now.AddMinutes(90);
  17.                 Response.Cookies.Add(cookie);
  18.  
  19.                 return Redirect("/home");
  20.             }
  21.         }
  22.         ModelState.AddModelError("LoginError", "Hatalı kullanıcı bilgisi");
  23.         return View();
  24.     }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top