小编shi*_*hab的帖子

如何在ASP.NET中无效密码尝试后阻止UserName

我使用以下代码检查用户名和密码.我希望在3次无效密码尝试后阻止用户名.我应该在我的代码中添加什么

MD5CryptoServiceProvider md5hasher = new MD5CryptoServiceProvider();
        Byte[] hashedDataBytes;
        UTF8Encoding encoder = new UTF8Encoding();
        hashedDataBytes = md5hasher.ComputeHash(encoder.GetBytes(TextBox3.Text));
        StringBuilder hex = new StringBuilder(hashedDataBytes.Length * 2);
        foreach (Byte b in hashedDataBytes)
        {
            hex.AppendFormat("{0:x2}", b);
        }
        string hash = hex.ToString();

    SqlConnection con = new SqlConnection("Data Source=Shihab-PC;Initial Catalog=test;User ID=SOMETHING;Password=SOMETHINGELSE");
    SqlDataAdapter ad = new SqlDataAdapter("select password from Users where UserId='" + TextBox4.Text + "'", con);
    DataSet ds = new DataSet();
    ad.Fill(ds, "Users");

    SqlDataAdapter ad2 = new SqlDataAdapter("select UserId from Users ", con);
    DataSet ds2 = new …
Run Code Online (Sandbox Code Playgroud)

c# asp.net visual-studio

2
推荐指数
1
解决办法
1439
查看次数

标签 统计

asp.net ×1

c# ×1

visual-studio ×1