Asp.net会员自动注销
我最近部署了一个使用 asp.net 成员身份 (SqlMembershipProvider) 的应用程序,我不知道为什么,但它会在不活动 1 分钟后自动注销。这在我的开发环境中不会发生。我什至将 userIsOnlineTimeWindow 设置为 60,这应该以分钟为单位。有什么想法为什么会发生这种情况吗?
我正在部署到共享托管环境上的虚拟目录。 这是我设置会员提供商的方法
<membership defaultProvider="FaceMoviesMembership" userIsOnlineTimeWindow="60">
<providers>
<clear/>
<add name="FaceMoviesMembership" type="System.Web.Security.SqlMembershipProvider" connectionStringName="FaceMoviesAuthConnectionString"
enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" maxInvalidPasswordAttempts="10"
passwordAttemptWindow="60" requiresUniqueEmail="false" passwordFormat="Clear" applicationName="FaceMoviesWeb"
minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0"/>
</providers>
I recently deploy an application that uses asp.net membership (SqlMembershipProvider) and I dont know why but it automatically log out after 1 minute of inactivity. This doesn´t happen on my development environment. I even set the userIsOnlineTimeWindow to 60 which is supposed to be in minutes. Any ideas why this is happening?
Im deploying to a virtual directory on a shared hosting environment.
Here is how I set up the membership provider
<membership defaultProvider="FaceMoviesMembership" userIsOnlineTimeWindow="60">
<providers>
<clear/>
<add name="FaceMoviesMembership" type="System.Web.Security.SqlMembershipProvider" connectionStringName="FaceMoviesAuthConnectionString"
enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" maxInvalidPasswordAttempts="10"
passwordAttemptWindow="60" requiresUniqueEmail="false" passwordFormat="Clear" applicationName="FaceMoviesWeb"
minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0"/>
</providers>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在此找到解决方案 博客。这是一个摘要:
Found the solution on this Blog. Here's an abstract:
如前所述,您的问题可能是实例问题。
用于加密/解密/散列的动态生成的 machineKey 在每台计算机上都会有所不同,从而导致应用程序的不同实例无法识别票证。
在 web.config 中显式指定 machineKey 部分将确保应用程序的所有实例都将遵守票证,无论来源如何。
在此处生成 machineKey 部分 http://www.developmentnow.com/articles/machinekey_generator.aspx
并将其粘贴到应用的
部分,以便应用的所有实例都将使用相同的加密密钥。这可能会解决您的问题。
As stated, your problem could be an instancing issue.
The dynamically generated machineKey, which is used for encryption/decryption/hashing, is going to be different on every machine resulting in tickets that are not recognized by different instances of your application.
Explicitly specifying a machineKey section in your web.config will ensure that all instances of your application will honor a ticket regardless of source.
Generate a machineKey section here http://www.developmentnow.com/articles/machinekey_generator.aspx
and paste it into the
<system.web>
section of your app so that all instances of your app will use the same encryption keys.This may solve your problem.