ASP.NET会话超时问题 [英] ASP.NET Session Timeout Problem

查看:95
本文介绍了ASP.NET会话超时问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hey Guys,



我在会话超时时出现问题



我的网站重定向一个回合5到10分钟后到登录页面



所以我把这行添加到web.config:

Hey Guys,

I''ve a problem in Session timeout

My website redirects to the login page after a bout 5 to 10 minutes

so i added this line to the web.config:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <connectionStrings>
    
  </connectionStrings>
  <system.web>
<sessionstate mode="InProc" cookieless="true" timeout="30" />
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms protection="All" loginUrl="login.aspx" defaultUrl="Home.aspx" timeout="2880" />
    </authentication>
    <authorization>
      <deny users="?" />
    </authorization>
    <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="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
      </providers>
    </profile>
    <roleManager enabled="false">
      <providers>
        <clear />
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>
    <customErrors mode="Off"></customErrors>
    <machineKey validationKey="3AE041467624C0947FE562E2DBE6122B532FBC4AA9845AE3D82EC6AC473104EA40A27F8E89BADDAEE44B1F7582FC47299B674ED1FD2DDE1368710504EB2C54C1" decryptionKey="2FC79A393A5A463F82D38828F43ED7D030C418B448C9E76C" validation="SHA1"/>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
</configuration>







但我仍然有问题



任何想法????




but i''m still have the problem

Any Ideas????

推荐答案

<system.web>
    <authentication mode="Forms">
          <forms timeout="50" />
    </authentication>

    <sessionstate timeout="60" />
</system.web>


您需要设置SessionState超时,这将使会话保持20分钟,然后才能重新登录:



You need to set the SessionState Timeout, this will keep the session for 20 minutes before having to log back in:

<configuration>
     <system.web>
         <sessionState timeout="20" />
     </system.web>
</configuration>


看看此链接如何增加会话超时。有许多选项可供尝试。
Have a look at this link How to increase session timeout. There are number of options available to try with.


这篇关于ASP.NET会话超时问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆