在注册时进行MD5加密以后
在登入的时候怎么读取?
怎么进行比较??

解决方案 »

  1.   

    获取数据库数据
    获取数据到SqlDataReader
    if(dr["password"].ToString().Equals(FormsAuthentication.HashPasswordForStoringInConfigFile("", "MD5"))
    {
    }
      

  2.   

    请问2楼的
    为什么没反应的啊。。你写的那个代码好像也没反应我这么写的 不过也没反应
     string getUname = this.TextBoxUname.Text.Trim();
                    string getPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.TextBoxPwd.Text.Trim(), "MD5");
                    string selectSql = "select Uname,Pwd from UserLogin where Uname='" + getUname + "'and Pwd='" + getPwd + "'";
                    SqlCommand com = new SqlCommand(selectSql, con);
                    SqlDataAdapter da = new SqlDataAdapter (com);
                   DataTable table = new DataTable ();
                    for(int i=0;i<table.Rows.Count;i++)
                    {
                   if (Convert.ToString(table.Rows[i][0]).Equals(getUname) && Convert.ToString(table.Rows[i][1]).Equals(getPwd))
                   {
                       ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "b", "alert('成功登入 ')", true);
                   }
                   else
                   {
                       ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "b", "alert('用户名或密码错误 请检查!')", true);
                       con.Close();
                   }