Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 表单身份验证未使用正确的凭据登录_Asp.net_Vb.net_Forms_Authentication_Login - Fatal编程技术网

Asp.net 表单身份验证未使用正确的凭据登录

Asp.net 表单身份验证未使用正确的凭据登录,asp.net,vb.net,forms,authentication,login,Asp.net,Vb.net,Forms,Authentication,Login,我正在尝试配置窗体身份验证以密码保护文件夹。即使凭据正确,它当前也不会登录任何用户 这是我的密码 Web配置: <authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="login.aspx" protection="All" timeout="999999"> <credentials passwordFormat="MD5"> <user name="adm

我正在尝试配置窗体身份验证以密码保护文件夹。即使凭据正确,它当前也不会登录任何用户

这是我的密码

Web配置:

<authentication mode="Forms">
  <forms name=".ASPXAUTH" loginUrl="login.aspx" protection="All" timeout="999999">
    <credentials passwordFormat="MD5">
      <user name="admin" password="passwordhashhere" />
    </credentials>
  </forms>
</authentication>
<authorization>
  <allow users="?" />
</authorization>
试一试


而不是第二个代码块中的

而且

<allow users="*" />

而不是第一个代码块中的
,或者它不是必需的

<div class="user">
    <p>Username:</p>
    <br />
    <asp:TextBox ID="TextBoxUser" runat="server"></asp:TextBox>
</div>

<div class="pass">
    <p>Password:</p>
    <br />
    <asp:TextBox ID="TextBoxPass" runat="server" TextMode="Password"></asp:TextBox>
</div>

<div class="login">   
    <asp:Button ID="ButtonLogin" runat="server" Text="Log In" />
    <asp:Label ID="LabelError" runat="server" Text=""></asp:Label>
</div>
Protected Sub ButtonLogin_Click(sender As Object, e As System.EventArgs) Handles ButtonLogin.Click
    If Membership.ValidateUser(TextBoxUser.Text, TextBoxPass.Text) Then
        If Request.QueryString("ReturnUrl") IsNot Nothing Then
            FormsAuthentication.RedirectFromLoginPage(TextBoxUser.Text, False)
        Else
            FormsAuthentication.SetAuthCookie(TextBoxUser.Text, False)
        End If
    Else
        LabelError.Text = "Invalid UserID and Password"
    End If
End Sub
<deny users="?" />
<allow users="*" />