// GET: Account public ActionResult Login() { if (HttpContext.User.Identity.IsAuthenticated) //eğer kullancı zaten loginse { AppUser user = _appUserRepository.FinByUserName(User.Identity.Name); //(finbyname ile karşılaştırdık) //kimliğini yakalayıp usera attık if (user.Status != Status.Passive) //statusu passive olmayanlar { if (user.Role == Role.Admin) //rolu admin olanlar { string cookie = user.UserName; //cookie bbizim burada proportylerimizi tutuyor.biyere yorum yazacağımızda fotoğrafımızı adımızı getiriyor. FormsAuthentication.SetAuthCookie(cookie, true); //user name'i cookie çökeltmiş olduk.sayfalar arasında kullanıcın bilgilerini taşımaya yardımcı olurlar. Session["UserName"] = user.UserName; Session["ImagePath"] = user.UserImage; return(Redirect("/Admin/Home/Index")); } else if (user.Role == Role.Author) //rolu authorsa { string cookie = user.UserName; //özelliklerini getir FormsAuthentication.SetAuthCookie(cookie, true); Session["UserName"] = user.UserName; Session["ImagePath"] = user.UserImage; return(Redirect("/Admin/Home/Index")); } else { string cookie = user.UserName; Session["UserName"] = user.UserName; Session["ImagePath"] = user.UserImage; return(Redirect("/Admin/Home/Index")); } } else { ViewData["error"] = "Usename or password are wrong..!"; //hiçir if yapısına uymuyorsa hata mesajı çıkar. return(View()); //register sayfasına redirect et//ve ana sayfaya getir. } } return(View()); }