コード例 #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            MSISUser User         = MSISUser.GetUser(creds, tboxUsername.Text);
            string   HashPassword = Crypto.CreateHash(tboxPassword.Text, User.Salt);

            if (User.Password == HashPassword)
            {
                SessionParams Params = Session["Params"] as SessionParams;

                if (Params == null)
                {
                    Params = new SessionParams();
                }

                Params.IsLoggedIn = true;
                Params.User       = User;
                Session["Params"] = Params;

                Response.Redirect("Home.aspx");
            }
        }
コード例 #2
0
ファイル: User.cs プロジェクト: bsestak/MSISAnnouncements
        private static MSISUser CreateUser(SqlDataReader reader)
        {
            MSISUser e = new MSISUser();

            try
            {
                while (reader.Read())
                {
                    e.Id        = Convert.ToInt32(reader["Id"].ToString());
                    e.FirstName = reader["FirstName"].ToString();
                    e.Lastname  = reader["LastName"].ToString();
                    e.UserName  = reader["UserName"].ToString();
                    e.Password  = reader["Password"].ToString();
                    e.Salt      = reader["Salt"].ToString();
                }
            }
            catch (Exception ex)
            {
                string s = ex.ToString();
            }

            return(e);
        }