protected void Application_PostAuthenticateRequest(Object sender, EventArgs e) { if (FormsAuthentication.CookiesSupported == true) { if (Request.Cookies[FormsAuthentication.FormsCookieName] != null) { try { //let us take out the username now string email = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name; string roles = string.Empty; using (EFramework EF = new EFramework()) { Users user = EF.users.SingleOrDefault(u => u.email == email); roles = "User"; } //let us extract the roles from our own custom cookie //Let us set the Pricipal with our user specific details HttpContext.Current.User = new System.Security.Principal.GenericPrincipal( new System.Security.Principal.GenericIdentity(email, "Forms"), roles.Split(';')); } catch (Exception) { //somehting went wrong } } } }
public AdminViewModel() { _EF = new EFramework(); _userRepo = new UserRepository(_EF); }
public UserLogic(EFramework EF) { _EF = EF; ur = new UserRepository(EF); }
public CharityLogic(EFramework EF) { _EF = EF; }