protected override bool AuthorizeCore(HttpContextBase httpContext) { kismizamanli2014Entities db = new kismizamanli2014Entities(); HttpCookie authoCookies = httpContext.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authoCookies != null) { if (this.Yetki == 0) { return(true); } FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authoCookies.Value); int id = Convert.ToInt32(ticket.UserData); var k = db.Kullanici.SingleOrDefault(x => x.kullaniciID == id); if (k.kullaniciTipID == this.Yetki) { if (this.PersonelYetki != 0) { var personel = db.Personel.SingleOrDefault(x => x.kullaniciID == id); if (personel == null) { return(false); } else { var p = db.PersonelYetki.SingleOrDefault(x => x.personelID == personel.personelID && x.yetkiTipID == this.PersonelYetki); if (p != null) { return(true); } else { return(false); } } } return(true); } } httpContext.Response.Redirect("/Home/Login"); return(false); }