<sessionState mode="InProc" cookieless="false" timeout="30"/>
Here's a good post that explains why: WHY DO I LOSE ASP SESSION STATE ON IIS6
Now after digesting the post, I'll give a simple solution you may try to solve that problem.
Step 1:
Change the sessionState in the web.config to an out of process like StateServer.
<sessionState mode="StateServer" stateConnectionString="tcpip=localhost:42424" cookieless="false" timeout="30"/>
We'll use the StateServer mode which is ASP.NET's special session handling method. Don't change the stateConnectionString, that is simply the port that will be used by the ASP.NET State Service.
Step 2:
Now let's configure the ASP.NET State Service.
In the server hosting the website, go to Start > Run > Type services.msc
Select ASP.NET State Service and right click it and select Properties.
Make sure to select Automatic in Startup type, so the service will start automatically everytime the server reboots. Then start the service.
Step 3:
Now try running the website and see if it already follows the timeout period you set in the web.config. If it does and you haven't encountered any problems then all is good, congrats!. But if you encountered this sneaky error:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Then your problem might be serialization. Because sessions that will be saved in the ASP.NET State Service must be serialized. Two things to make sure is to first serialize all your local classes like this:
[Serializable]
public class SampleClass
{
}
Place a Serializable tag before the declaration of the class.
Second is to make sure you're not using classes that cannot be serialized like Web Controls (Button, Textbox, Table, etc.). Just search msdn for other non-serializable classes.
If you followed these steps your website should be running okay by now.
Here's some topics you might be interested:
Session-State Modes
Serialization
-elyk
Very great post. I simply stumbled upon your blog and wanted to say that I have really enjoyed browsing your weblog posts. After all I’ll be subscribing on your feed and I am hoping you write again very soon!
ReplyDeleteI don’t know how should I give you thanks! I am totally stunned by your article. You saved my time. Thanks a million for sharing this article.
ReplyDeleteI certainly agree to some points that you have discussed on this post. I appreciate that you have shared some reliable tips on this review.
ReplyDeleteSelam admin guzel konular ve guzel site basarilarin devamini bekleriz tanks
ReplyDeleteI am extremely impressed along with your writing abilities, Thanks for this great share.
ReplyDeleteHey keep posting such good and meaningful articles.
ReplyDeleteI really appreciate your professional approach. These are pieces of very useful information that will be of great use for me in future.
ReplyDeleteGreat article, Thanks for your great information, the content is quiet interesting. I will be waiting for your next post.
ReplyDeletePHP7 Sodium Encryption Decryption
ReplyDeletePHP Server Side Form Validation
Contour Detection using Python OpenCV
HTML Table Alternate Row Color using PHP
PHP User Authentication by IP Address