问题描述
simplemembership是否有一种简单的方法来设置超时,以在您不活动后经过一定时间后自动注销您?
Does simplemembership have an easy way to set a timeout to automatically log you out after a certain amount of time has passed while you've been inactive?
推荐答案
SimpleMembership不提供您可以配置的超时,而身份验证机制则可以.
SimpleMembership doesn't provide a timeout you can configure, the authentication mechanism does.
如果您使用的是FormsAuthentication,则可以在此处设置此超时时间:
If you are using FormsAuthentication, you can setup this timeout here:
<authentication mode="Forms">
<forms loginUrl="~/Login" timeout="20" slidingExpiration="true" />
</authentication>
在上面的示例中,超时设置为20分钟.这意味着,一旦用户通过身份验证,身份验证cookie(包含身份验证票证)将在闲置20分钟后过期.
In the example above the timeout is set to 20 minutes. This means that the authentication cookie (containing the authentication ticket) will expire after 20 minutes of inactivity once the user is authenticated.
除其他职责外,成员资格提供者还负责验证用户凭据.但是,它不负责识别"对经过身份验证的用户的后续请求.
The membership provider is responsible to validate the user credentials, among other responsibilities. However it is not responsible of "recognizing" subsequent request for authenticated users.
请检查此文章,以便您更好地了解幕后发生的事情.
Please check this article so you have a better idea about what is happening behind the scene.
这篇关于Simplemembership的超时选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!