ASP.NET 4 会员机器密钥

发布于 2024-12-24 03:26:45 字数 308 浏览 0 评论 0原文

我的 ASP.NET 4 会员网站已经运行了大约 5 个月,今天我更改了正则表达式以放宽密码限制。我仍然可以创建和访问新帐户,但无法再访问任何以前注册的帐户。

我检查了数据库并确认它们仍然存在。我最初的想法是密码不正确。我检查了两个我知道密码的帐户,但都无法访问。我尝试使用密码恢复选项,但当我输入用户名时,我被告知该用户不存在。

当我检查数据库并查阅成员资格和个人资料表时,新旧用户、正则表达式更改前后都在同一个表中。这让我有了最后的发现,也是我没有经验的发现。是否有一个新的机器密钥正在创建新用户但无法破译旧用户,从而使它们不可用?如果是这样,我该如何解决这个问题?

I have had a working asp.net 4 membership wesite for about 5 months and today I changed the regex to loosen the password restrictions. I can still create and access new accounts, but can no longer access any of the previously registered ones.

I have checked the database and confirmed that they are all still there. My initial thought was an incorrect password. I've checked two accounts that I knew the password for and both are inaccessable. I attempted to use the password recovery option, but when I type in the username I'm told that the user does not exist.

When I check the databases and consult both the membership and profile tables, the old and new users, pre and post regex change, are all in the same table. This leads me to my final discovery and the one that I have no experience. Is there a new Machine Key that is creating the new users but cannot decipher the old ones, hence making them unavailable? If so, how can I fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一腔孤↑勇 2024-12-31 03:26:45

就像您的评论一样,我的第一个想法是应用程序密钥已被更改。此密钥存储在 web.config/system.web/membership 中:

<membership>
  <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider"
      ...
      applicationName="YOUR_KEY_HERE" />
  </providers>
</membership>

此密钥允许具有相同成员资格提供程序的不同应用程序(例如您的情况下的 System.Web.Security.SqlMembershipProvider)使用相同的用于存储会员数据的数据库。

一个提供商不会看到来自另一提供商的用户,反之亦然,因为他们在查询数据库时会考虑应用程序名称。但是,当您查看 Users 表时,您可能不会立即注意到这种关系,因为 SqlMembershipProvider 使用 Users 表中的 Guid。但它是“应用程序”表的外键,您可以在其中找到应用程序名称。

另请参阅:配置 ASP.NET 2.0 成员资格时始终设置“applicationName”属性和其他提供商

Like your comment my first thought was that the application key has been altered. This key is stored in web.config/system.web/membership:

<membership>
  <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider"
      ...
      applicationName="YOUR_KEY_HERE" />
  </providers>
</membership>

This key allows different applications with the same membership provider (e.g. the System.Web.Security.SqlMembershipProvider in your case) to utilize the same database for storing membership data.

One provider will not see users from the other provider and vice versa, because they take the aplication name into account when querying the database. But when you look at the Users table, you may not notice immediately the relation, since the SqlMembershipProvider uses a Guid in the Users table. But it's a foreign key to the Applications table, where you can find the application name.

See also: Always set the "applicationName" property when configuring ASP.NET 2.0 Membership and other Providers

裸钻 2024-12-31 03:26:45

我的问题略有不同*,但我在 web.config 中指定了自己的机器密钥。请参阅此处的详细信息:http://msdn.microsoft.com/en-us/ library/ff649308.aspx

(*我的应用程序在大型虚拟化服务器场中从一个服务器漫游到另一个服务器,因此每次跃点都会更改计算机密钥,导致应用程序无法读取之前设置的 cookie。)

My problem was slightly different* but I specified my own machine key in web.config. See the details here: http://msdn.microsoft.com/en-us/library/ff649308.aspx

(* my app was wandering from server to server in a large virtualized server farm hence changing the machine key with each hop causing the app being unable to read the cookies it has previously set.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文