Asp.net 表单身份验证未使用正确的凭据登录
我正在尝试配置窗体身份验证以密码保护文件夹。即使凭据正确,它当前也不会登录任何用户 这是我的密码 Web配置: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
<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="*" />