Click here to Skip to main content
15,914,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
<?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????
Posted
Updated 7-May-13 3:39am
v3
Comments
Joezer BH 7-May-13 9:36am    
provide some more details on your configuration mate.

Do you some code that may be performing the redirection,
Do you have ANY redirection on the server/client side?
_ProgProg_ 7-May-13 10:04am    
i am only redirecting to the login page if the user does't have privilage to that page
and this code is in the master page load.
i get the user privilage from a datatable stored in the session
Osman24 7-May-13 10:10am    
Did you look at IIS session timeout value for your website
_ProgProg_ 7-May-13 10:12am    
no i didn't but i will do that now
_ProgProg_ 7-May-13 10:22am    
my server settings is
Session timeout (minutes) = 20

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

    <sessionstate timeout="60" />
</system.web>
 
Share this answer
 
You need to set the SessionState Timeout, this will keep the session for 20 minutes before having to log back in:

XML
<configuration>
     <system.web>
         <sessionState timeout="20" />
     </system.web>
</configuration>
 
Share this answer
 
Have a look at this link How to increase session timeout. There are number of options available to try with.
 
Share this answer
 
Try storing your session state in SQL its quite useful

here are some references if you like the approach:

Session management options in ASP.NET[^]

http://support.microsoft.com/kb/317604[^]

http://asp-net.vexedlogic.com/2012/05/23/aspasp-net-session-timeout-how-do-i-change-it/[^]

Thanks :)
 
Share this answer
 
Try to use less Session Variable , remove them when they are not in use
because Session Variables are stored in Server Memory , using more Session variable may Slowdown your application performance.

Sometime you may get Session TimeOut error.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900