public static void LogonUserByRssKey(Guid rssKey) { using (IDataReader reader = DBUser.GetUserInfoByRssKey(rssKey)) { if (!reader.Read()) { throw new Mediachase.Ibn.AccessDeniedException(); } int userId = (int)reader["UserId"]; try { string sUserLight = "userlight"; // check user's name and password here UserLight currentUser = UserLight.Load(userId); if (currentUser == null) { throw new Mediachase.Ibn.AccessDeniedException("Exception in user authentication"); } if (HttpContext.Current.Items.Contains(sUserLight)) { HttpContext.Current.Items.Remove(sUserLight); } HttpContext.Current.Items.Add(sUserLight, currentUser); HttpContext.Current.User = new GenericPrincipal(new GenericIdentity(currentUser.Login), null); } catch (Exception ex) { throw new Mediachase.Ibn.AccessDeniedException("Exception in user authentication", ex); } } }