public static string MD532(string HashString)
    {
        return FormsAuthentication.HashPasswordForStoringInConfigFile(HashString, "MD5").ToLower();
    }MD5  32位加密

解决方案 »

  1.   

    string UserPwd = MD532(this.TextBox2.Text.Trim());
      

  2.   

    protected void Button2_Click(object sender, EventArgs e)
        {
           
            if (Page.IsValid)
            {
                string UserName = this.TextBox1.Text;
                string UserPwd = this.TextBox2.Text;
                //下面为加密操作
                string UserPwd=FormsAuthentication.HashPasswordForStoringInConfigFile(UserPwd, "MD5")
                Users SingleUser = new Users();
                StudentManager..Encrypt(TxtUserPwd
                SingleUser.UserName = UserName;
                SingleUser.UserPwd = UserPwd;
                if (Users.AddUser(SingleUser))
                {
                    this.Label1.Text = ("恭喜!您已经添加成功!");
                    this.GridView1.DataBind();            }
                else
                {
                    this.Label1.Text = ("抱歉!你没有添加成功!");
                }
       
            }
        }
      

  3.   

    FormsAuthentication.HashPasswordForStoringInConfigFile(UserPwd, "MD5")
      

  4.   

    下边这个函数我用了一年了,保证有效。
    不给分你就对不起我!!!!!!!!!!!! @v@public static string MD5(string toCryString)
            {
                string cryptedstring = string.Empty;
                cryptedstring = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(toCryString, "MD5");
        
                return cryptedstring;
            }
      

  5.   

    主要是用这个了,lz可以在vs中F1看下都有例子的。System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile