| Home » Categories » Multiple Categories |
Issue with Storing Session |
|
Article Number: 301 | Rating: Unrated | Last Updated: Wed, Sep 24, 2025 at 12:08 AM
|
Sometimes, the session on your website can expire earlier than you expect. The followings are the steps you need to check:
1. In .Net, you cannot use authentication without session. The session ID can be transmitted with client either in a cookie, or in the page url. There is no need to choose between session and cookie, as the cookie actually holds the session id.
2. On the server, session data is stored either in memory (in process or outside process), or in database.
3. The cookie is encrypted using a key called the "machine key". By default, everytime the app pool is recycled, a new machine key is created and the session data that is in memory is lost. On a shared server, this results in the end of a session, since the cookie cannot be decrypted anymore.
The solution: Store a static machine key in the web.config of the web application.
Also, storing the session data in the database instead of memory (in proc) can be useful to preserve sessions.
|
Attachments
There are no attachments for this article.
|
How to Deploy and host .Net Core 2 and Angular 6 app
Viewed 14037 times since Tue, Oct 23, 2018
I cannot find a way to enable ASP.NET 4.5 on my Control Panel
Viewed 11539 times since Tue, Sep 11, 2012
My site is showing 500 Internal Server error message. What is wrong here?
Viewed 4326 times since Thu, May 3, 2012
How To Solve Problem with Connection String on EF (Entity Framework) 4 or above
Viewed 32960 times since Mon, Apr 1, 2013
How to solve ReportViewer error message: "An error has occurred during report processing. Input string was not in a correct format"
Viewed 8758 times since Tue, Jun 18, 2013
How do I query MySQL Database in PHP ?
Viewed 3898 times since Tue, May 1, 2012
I am unable to renew my Let’s Encrypt SSL
Viewed 3167 times since Thu, Aug 23, 2018
I receive this error message: "Directory Listing Denied. This Virtual Directory does not allow contents to be listed."
Viewed 11254 times since Mon, Apr 30, 2012
I get an error Server.CreateObject Failed when I try to use CDONTs. What can I do?
Viewed 3431 times since Tue, May 1, 2012
Why do I suddenly receive the error message: "Compiler Error Message: The compiler failed with error code XXXXXXXXX"?
Viewed 18329 times since Wed, Feb 17, 2016
|
