ASP.NET using md5 to authenticate users
<p>Currently i am doing a little project, the user registration password field is encrypted in the database, therefore I need to authenticate users using md5 algorithm also but my code is not working, whenever i try to input the correct password(unencrypted) it enters but later out i figured out that any password I type, the system will accept it even it doesn't matches in the database.</p>

<p>Can you help me? Here is my code:</p>

<pre><code> protected void btnSubmit_Click(object sender, EventArgs e)
    {

        string pAssword = txtPassword.Text;
        MD5CryptoServiceProvider encryptor = new MD5CryptoServiceProvider();
        byte[] encryptedValue;
        UTF8Encoding encoder = new UTF8Encoding();
        encryptedValue = encryptor.ComputeHash(encoder.GetBytes(pAssword));

        DataSet ds = new DataSet();
        ds = (startWebService.getAllUsers());
        if (ds.Tables[0].Rows.Count &gt; 0)
        {
            foreach (DataRow dRow in ds.Tables[0].Rows)
            {

                string userName = dRow["UserName"].ToString();
                string passWord = dRow["Password"].ToString();
                string acctNo = dRow["AccountNumber"].ToString();

                if (userName == txtUsername.Text.ToString() &amp;&amp; acctNo == txtAcctNo.Text.ToString() &amp;&amp; passWord == encryptedValue.ToString() )
                {
                    FormsAuthentication.RedirectFromLoginPage(txtUsername.Text.ToString(), false);
                    lblError.Text = "You got it!";
                    Response.Redirect("MyAccount.aspx");
                }
                else
                {
                    this.lblError.ForeColor = System.Drawing.Color.Red;
                    this.lblError.Text = "Either you have been type an incorrect network credentials or you have reached the maximum login attempts for your account.Please try again or contact the system administrator.";

                    startWebService.updateFailedLogin(txtAcctNo.Text.ToString(), txtUsername.Text.ToString());

                }

            }

        }

    }
</code></pre>

<p>my web services:</p>

<pre><code>    private DataSet GetDataSet(string strSPROC)
    {

        SqlConnection conn = new SqlConnection(connectionString);
        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandText = strSPROC;
        conn.Open();
        SqlDataAdapter myDataAdapter = new SqlDataAdapter();
        myDataAdapter.SelectCommand = cmd;
        DataSet dsMT = new DataSet();
        myDataAdapter.Fill(dsMT);
        return dsMT;
        conn.Close();
    }
  [WebMethod]
    public DataSet getAllUsers()
    {
        return GetDataSet("ELMS_ALLINTERNETUSERS");
    }
</code></pre>

<p>Please help me, I have to correct this in a way that the system will accepts the correct equivalent of encrypted text for example I type: spain = wdhs3x9029 but i tried to type philippines , it accepts also.</p>
