ASP.NET成员资格保持通过身份验证的问题 [英] ASP.NET Membership staying authenticated issues
问题描述
因此,我的应用程序很奇怪,因为当您登录时,您将停留一两个页面的登录状态,然后迷路.我的设置是这样:
So, my application is being odd in the fact that when you login you will stay logged in for a page or two then get lost. My settings are this:
<authentication mode="Forms">
<forms name=".ASPXFORMSAUTH" timeout="20"/>
</authentication>
<authorization>
<allow users="*" />
</authorization>
<membership defaultProvider="MySqlConnection" userIsOnlineTimeWindow="45">
<providers>
<clear />
<add name="MySqlConnection" type="System.Web.Security.SqlMembershipProvider" connectionStringName="MySqlConnection"
applicationName="HQChannel"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
minRequiredNonalphanumericCharacters="0"
minRequiredPasswordLength="6" />
</providers>
</membership>
感谢您的帮助.
推荐答案
2件东西对我来说很突出.首先是您允许*用户而不是?用户. *表示匿名,?表示已通过身份验证.我将其更改为以下&看看是否有帮助...
2 things stand out for me here. First is that you're allowing * users instead of ? users. * means anonymous, ? means authenticated. I'd change it to the following & see if that helps...
<authorization>
<allow users="?" />
<deny users="*" />
</authorization>
第二个想法是您想向您的身份验证块添加slideingExpiration ="true".这将使登录进入一个滑动窗口-因此,只有在闲置20分钟后,他们才会注销...
2nd thought would be that you'd want to add slidingExpiration="true" to your authentication block. That'll make the login into a sliding window - so they only get logged out after 20 minutes of inactivity...
<forms name=".ASPXFORMSAUTH" timeout="20" slidingExpiration="true" />
这篇关于ASP.NET成员资格保持通过身份验证的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!