Session Timeout value not working from Web.Config ASP.Net

Last Reply one year ago By kalpesh

Posted one year ago

i have set session timeout as 120minutes.i have filled the details of the form and i went to some other page and return back to fill the incomplete form and i found that it goes to the login page.what will be the issue?

web.config:

 

<system.web>
    <machineKey validationKey="7F962D9FAC5BA3E79A71E722B0FD79BAF52618501DABB750004795CFFDF1AC6BD66BA5FF028DE94730C2FBA150C8A049CC7B35B2CE4CC60BEF0AE47B36CBA5DF" decryptionKey="F6572AF020B96CB22ED4B987E2C0DB0DA6E68493A7F07C6F37F574907F91FDA6" validation="SHA1" decryption="AES"/>
    <trace enabled="false" pageOutput="false" requestLimit="15" mostRecent="false"/>
    <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
    <sessionState timeout="120" cookieless="false" mode="InProc"/>
    <!--<sessionState timeout="120"/>-->
    <compilation debug="true">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
    <authentication mode="Windows"/>
    <!--<authentication mode="Forms">
      <forms loginUrl="~/expo_crm/user_login.aspx" timeout="60" />
    </authentication>-->
    
    <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    <customErrors mode="Off"/>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </controls>
    </pages>
    <httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
    </httpHandlers>
    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </httpModules>
    <siteMap enabled="true">
      <providers>
        <add name="MyNewSitemapProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="~/expo_crm/all_reports/admin_report.sitemap"/>
      </providers>
    </siteMap>
  </system.web>

 


Posted one year ago

I seen you shared code.
But we can set the sessionstate in web config or in Global.asax file in Session_Start. As explained in below reply of thread which already shared to you.

https://www.aspforums.net/Threads/772327/Increase-session-timeout-to-1-hour-in-ASPNet/Replies/1#Replies

If something other problems you are getting then debug your code on which movement you page get redirected to the login page as you already sets the sessionstate value in webconfig file.