Session Timeout

Siripurapu Deepthi 11 Reputation points
2022-08-30T13:10:57.187+00:00
  • Overview:

Our ASP.NET 3.5 framework based web application is upgraded to .Net 4.8. There is no change to the code and the way sessions are handled.
For some of the users the session timeout occurs though the inactivity on the page is less than 2-3 mins. This is happening across all browsers and devices. The session timeout set for the application is 45 mins. However, the session gets timeout even before that when the user navigates from one page to another or perform some action on the webpage. This is happening intermittently and not all users are facing this. The volume of session timeouts is proportional to the overall web traffic. But this persists every day irrespective of the volume of traffic.

  • Action taken(so far):
    1. Added logs and exception handling on the major user events.
    2. Handled the null session data in all the webpages.

There is no log which indicates if the user has been timed out at a specific page and event. The issue is very random that we are not able to find the exact root cause.

Can you please suggest if this has anything to do with version upgrade, as this seems to be increasing post .net framework upgradation. Also please suggest if there is any solution for this. This seems to be very random at pages and users.

Please suggest.

Developer technologies ASP.NET Other
{count} votes

2 answers

Sort by: Most helpful
  1. QiYou-MSFT 4,326 Reputation points Microsoft External Staff
    2022-08-31T05:45:43.983+00:00

    Hi @Siripurapu Deepthi ,
    I would like to ask if your code under the Web.Config configuration is:

    <sessionState mode="InProc" timeout="xx"/>  
    

    If so, the reason is that the configuration saves session in the IIS process, which is unstable, resulting in the loss of session.You can fix the problem by changing the code to:

    <sessionState mode="StateServer" stateConnectionString="xxxx" timeout="xxx"/>  
    

    Compared with InProc mode and StateServer mode, InProc mode acquires Session fast but is easy to lose, while StateServer mode acquires Session slowly but is not easy to lose. In addition to setting a timeout in the code, you need to modify the response configuration in IIS to prevent session from failing

    IIS Manager - > Application Pool - > advanced settings

    Modify [Fixed Interval] under the Recycle tab and [Idle Timeout] under the Process Model tab.

    As for what you said, there may be problems due to the update of the version, which is usually backward compatible, but there may be some Ajax settings in your code or some writing formats that may have changed in the new version, you can check the following documentation:

    https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/version-compatibility
    https://learn.microsoft.com/en-us/previous-versions/aspnet/ms178581(v=vs.100)

    Best regards,
    Youqi


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Siripurapu Deepthi 11 Reputation points
    2022-09-01T14:35:18.5+00:00

    Thanks Youqi! That helps. Is there any related document which helps us setting the App pool config([Fixed Interval] under the Recycle tab and [Idle Timeout] under the Process Model tab.) as suggested by you.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.