private void CheckLoginInfo() { Guid userID; userID = UserRepository.GetUserID(tbxEmail.Text, tbxPassword.Text); if (userID != Guid.Empty) { SessionHelper.UserID = userID; SessionHelper.UserEmail = tbxEmail.Text; System.Nullable <Int16> privelegeMask = 0; privelegeMask = UserRoleRepository.GetMinPrivelegeMask(userID); if (privelegeMask.HasValue) { if (privelegeMask == 1) { return; } SessionHelper.IsAuthenticated = true; privelegeMask = UserRoleRepository.GetMaxPrivelegeMask(userID); if (privelegeMask == 127) { SessionHelper.IsModerator = true; } if (privelegeMask >= 254) { SessionHelper.IsAdmin = true; } } //Cookies for login. HttpCookie emailCookie = new HttpCookie("EmailCookie"); emailCookie.Expires = DateTime.Now.AddMonths(1); //Push email to cookie. emailCookie["Email"] = tbxEmail.Text; //Add cookie to user's brouser. Response.Cookies.Add(emailCookie); Response.Redirect("~/UserProfile.aspx?id=" + SessionHelper.UserID); } }