A session weighs on the server? So you’re doing something wrong.
A session on the server stays in memory as long as it takes or the ASP.NET policy determines, if the application does not invalidate, and if nothing goes wrong in the middle of the way that destroys the session. Don’t consider the session to be trustworthy and secure. It shouldn’t be common for you to miss the session, but don’t treat it as if it couldn’t happen. If it happens often there’s something very wrong with what you’re doing.
There are ways to change this, including allowing session distribution, but I don’t think that’s the case here.
One way to ensure more security in the data that would usually be in session is to store in database, so even a failure would still keep everything running if you have proper code to deal with this, it’s your problem to do it properly.
I’m talking about security in the sense of reliability and persistence not data protection, especially in sessions do not consider the data as safe, so be careful what you store in them.
There is the possibility to make the session itself be stored in database, but almost always does not make much sense because you can do otherwise with more flexibility and performance, the standard session is to be simple and with high performance.
Note that the session is, and has always been, controlled by a cookie, just don’t have the data kept on it. You need some identification to understand that you are "talking to the same person". I’m not going to go into detail about his use, but it’s just kind of a session signature and not the session itself. You can configure how this identification can be formed right there in the options you started to configure.
If you want data to be kept between sessions directly on cookie you can, it’s just not recommended. It’s complicated, a lot can go wrong and it’s less safe. Even configuring the way you did the data is still on the server.
There are other ways when the cookie is not interesting or does not work in a certain scenario, but in general are less safe.
There are other ways to maintain status when you don’t exactly need a session, analyze if you can use.
Additionally I have to say that the standard of Idle is 20 minutes, some people consider this little, you put in 10 seconds, which probably makes the session useless since it is extremely common not to have interaction for more than 10 seconds.
I don’t understand why you think the session isn’t on the server now, it’s still on.
I read in some places that excessive use of Sesssions can slow down the application, hence the observation. Regarding thinking that the session does not stay on the server was due to this relationship with cookies (in the browser) and this was recovered dynamically in the requests.
– Victor Laio
If you abuse it, of course it is bad. Cokkies have always been used, but never (under normal conditions) if you used the session in the cookie, only the same ID. Note that nothing has changed in ASP.NET, it has changed the way of configuring only.
– Maniero
Understood, thank you!
– Victor Laio