0
私はMVC5でASP.NET IDを使用しており、設定された期間を過ぎるとログインしたユーザーの有効期限を切ることを望みます。私は、web.configファイルでのsystem.webするセクションを追加しました:MVC5での認証タイムアウト
var authenticationManager = HttpContext.GetOwinContext().Authentication;
authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
var identity = await _userManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = false }, identity);
しかし、ユーザーがログオンされることはありません。私も永続的なCookieを使用しないようにログインコードを変更した
<authentication mode="Forms">
<forms timeout="1" slidingExpiration="false"/>
</authentication>
彼らは永遠にログインしたままです。