脑抽了一下。
ASP.NET 4.0.
Web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<authentication mode="Forms">
<forms name="DataViewer" loginUrl="login.aspx">
<credentials passwordFormat="Clear">
<user name="devuser" password="test" />
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
还有一个登录控件:
<asp:Login ID="login" runat="server" />
当我输入用户名和密码并单击“登录”时,它卡住了。
如果我断点调试,我可以看到调用堆栈中login.AuthenticateUsingMembershipProvider()
正在调用SqlMembershipProvider.ValidateUser()
。在这个项目中根本没有定义或涉及数据库,而且我也没有指定要使用 SqlMembershipProvider。
所以我的问题是,我应该使用哪个成员资格提供程序使ASP.NET使用web.config
中的<credentials>
元素中的用户名和密码?