ASP.NET IDを使用して新しいASP.NET MVC Webサイトを作成しました。私はVisual Studio 2017で生成された標準ロジックを使用しており、個別のユーザーアカウントを選択しました。ログインタイムアウトを増やす
すべての機能は正常に動作しますが、約10〜20分以内にログインしていないようですが、これ以上ログインする必要はありません。
Googleで検索したところ、CookieAuthenticationOptions.ExpireTimeSpan
の設定に関する情報が見つかりました。ただし、デバッガを使用すると、この値はデフォルトで14日間に設定されています。
Startup.Auth.cs:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
},
//SlidingExpiration = true, // Default: true
//ExpireTimeSpan = TimeSpan.FromHours(1) // Default: 14 days
});
のWeb.Config:
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.6" />
<httpRuntime targetFramework="4.5.2" executionTimeout="240" maxRequestLength="20480" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
<customErrors mode="Off"></customErrors>
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthentication" />
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="20971520" />
</requestFiltering>
</security>
</system.webServer>
だから、誰もが私が原因ログアウトを取得するまでの時間の量を増加させる方法を知っているん不活動に?タイムアウト時間をミリ秒
ありがとうございますが、フォーム認証は古い方法であり、ASP.NET IDは新しい方法です。確かに、唯一の答えは私が物事を古い方法で行わなければならないということではありません。 –