在没有 .Net 提供程序的情况下使用表单身份验证
我想使用表单身份验证以及我在 web.config 中定义的用户名和密码来保护我网站的一部分。当我尝试登录时,我收到以下消息。
Server Error in '/' Application.
Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
我猜测发生这种情况是因为它尝试使用 LocalSqlServer 连接字符串定义的成员资格表。 我不想使用会员功能,如何配置我的网络应用来实现这一点?
我需要自己为内置登录控件编写身份验证函数吗?
I want to protect a section of my website using forms authentication with the username and password as defined by me in the web.config. When I attempt to login I get the message below.
Server Error in '/' Application.
Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
I'm guessing this is happening because it's attempting to use the Membership tables as defined by the LocalSqlServer connection string. I don't want to use the Membership features, how do I configure my web app to do that?
Will I need to write the Authenticate function myself for the in-built Login control?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this:
问题不在于您的配置文件,而在于登录控件。
登录控件使用 machine.config 中定义的默认成员资格提供程序。 (它是一个指向 SQL Express 数据库的 SqlMembershipProvider)。
您根本不想使用默认的会员提供程序。只需创建您自己的登录页面并使用以下服务器端逻辑来验证凭据并将用户登录到站点:
The problem isn't with your config file, it's with the Login control.
The Login control uses the default Membership Provider that is defined in the machine.config. (It's a SqlMembershipProvider that points to a SQL Express database).
You don't want to use the default Membership Provider at all. Simply create your own login page and use the following server-side logic to validate the credentials and log the user into the site: