我需要在网上发布一个演示网站。我需要保护对该网站的访问。
使用SQL Server作为成员资格提供程序的实时站点。但是,对于演示站点,我只能发布到简单的Web主机,而不能访问SQL Server。
我只需要一个用户,他们不需要更改密码等选项。因此,我认为最简单的方法是使用web.config中的成员。我创建如下:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authentication mode="Forms">
<forms name="ProjectApple" loginUrl="~Login.aspx">
<credentials passwordFormat="Clear">
<user name="lawyer" password="Super12."/>
</credentials>
</forms>
</authentication>
<compilation debug="true"/>
</system.web>
</configuration>
我可以使用SHA1哈希。问题是,它可以识别出我输入的密码无效的时间。但是,当我输入正确的密码时,我得到以下信息:
Cannot open user default database. Login failed.
Login failed for user 'RB-T510\Rob'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
Login failed for user 'RB-T510\Rob'.
我不知道为什么要寻找SQL?有人可以帮忙吗?
我正在使用VS2010和.Net 3.5
非常感谢,
抢
最佳答案
要在web.config中使用带有凭据的表单例份验证,必须使用FormsAuthentication.Authenitcate方法。看起来您具有尝试访问成员资格类的默认登录控件。