プロジェクトにいくつかのコードを調査して実装しましたが、20分後にセッションがログアウトしてログインページに戻ります。 httpruntime
またはsessionstate
またはglobal.asax
にタイムアウトを追加するか、またはIISアプリケーションプールでIdle Timeout
を増やしても、動作していないようです。asp.netで「20」分後にセッションがログアウトした場合はどうすればよいですか?
web.configファイル:
<authentication mode="Forms">
<forms name="__authcookie" loginUrl="LoginPage.aspx" timeout="60" protection="All" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" enableCrossAppRedirects="false"/>
</authentication>
<sessionState mode="InProc" timeout="60" customProvider="AppFabricCacheSessionStoreProvider"></sessionState>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AppFabricCacheSessionStoreProvider" type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" cacheName="NamedCache1" sharedId="SharedApp"/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
のGlobal.asax:あなたはあなたのセッションにしたくない場合にも、あなたのweb.config
ファイル
<system.web>
<authentication mode="Forms">
<forms timeout="50"/>
</authentication>
<sessionState timeout="60" />
</system.web>
にこれを追加すること
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
Session.Timeout = 60;
}