string s = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtPassWord.Text.Trim(), "MD5"); 
txtPassWord.Text = s; 
我在登录页写了这句,好像就没有把我输入的转换成MD5直接就进行比较了?怎么才能把我输入的转换成MD5在进行比较呢?? 
我的SQL是: 
SELECT [stuUserName],[stuPassWord] FROM StudentInfo 
WHERE stuUserName=@stuUserName AND stuPassWord=@stuPassWord 
我在注册页面也写了这句,然后把密码转成了MD5后插入了数据库中 
string s = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtPassWord.Text.Trim(), "MD5"); 
txtPassWord.Text = s;

解决方案 »

  1.   

    你的代码中,txtPassWord.Text = s 是赋值,不是比较
    string sTxt = this.txtPassWord.Text;
    string s = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtPassWord.Text.Trim(), "MD5");
    if(sTxt == s)

       //登录成功
    }
    else
    {
      //登录失败
    }
      

  2.   


    string sTxt = this.txtPassWord.Text;
    string s = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtPassWord.Text.Trim(), "MD5");
    string Pwd = dbOpCls.GetPwd("SQLCmd");
    if(Pwd == s)

       //登录成功
    }
    else
    {
      //登录失败
    }
      

  3.   


    string sTxt = this.txtPassWord.Text.Trim();
    string s = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sTxt, "MD5");
    string Pwd = dbOpCls.GetPwd("SQLCmd");
    if(Pwd == s)

       //登录成功
    }
    else
    {
      //登录失败
    }