Session getting expired on file upload or modification in web.config in asp.net

sam
sam
134 Points
62 Posts

Hi

I am using session to maintain session state. Application hosted on IIS share hosting plan. When any .dll file or web.config modified on the server, session getting expired. Also some session expired a very short time. What is the reason for this.

Please help.

Views: 8168
Total Answered: 1
Total Marked As Answer: 0
Posted On: 23-Dec-2015 09:16

Share:   fb twitter linkedin
Answers
NiceOne Team
NiceOne...
Admin
404 Points
67 Posts
         

Hi Sam,

The main reason of session getting expired is that Application Pool is restarting. Since Session State Mode by default of a web application is InProc.

You can solve this problem using following methods:

  • Use Other Session State Mode like StateServer or SqlServer.
  • Use cookies for Session State management.

For Session State Mode Use following section in web.config

<configuration>
<system.web>
<sessionState mode="InProc"
          cookieless="false"
           timeout="20"/>
</system.web>
</configuration>
Posted On: 26-Dec-2015 00:34
 Log In to Chat