2012-05-11 3 views
1

プロジェクトにいくつかのコードを調査して実装しましたが、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; 
     } 

答えて

0

タイムアウトするセッションではなく、認証である可能性があります。認証は、<authentication>要素(デフォルトでは.ASPXAUTH cookie)を使用して制御されます。これは、セッション(デフォルトではAspnet_SessionId cookie)とは異なります。

<authentication>要素のtimeout属性を使用します。

関連する問題