Ah, the previous system sessions were lost for some reason, and they could not be stored in the server process.
The client is always lost and then exits for no reason. You cannot set the session time to 1 hour.
Finally, I had no choice but to put the session in the database. Haha, the problem is solved.
It took one week for no customer to reflect the problem.
Maybe everyone has different requirements, but I still feel that the session is stored in the database for insurance.
The specific setting method will not be followed. I will reply.
Sorry, I forgot to read the post yesterday. So many friends didn't know about it. I will post the method now.
I. desktop -- start -- run -- cmd
CD to "X: \ windows \ Microsoft. NET \ framework \ v2.0.50727"
(I don't know how to operate cmd)
2. Continue writing in cmd:
Aspnet_regsql.exe-S server IP-u database login name-P Database Password-D database-ssadd-sstype C
For example
Aspnet_regsql.exe-s 127.0.0.1-U sa-P 7654321-D studentsession-ssadd-sstype C
Database to be put into: You can use the database of the system you are working on, or you can write a new database.
For example, my statement, I am working on a student system with a database student.
I want to put the session in the database studentsession.
After you execute that sentence, you can create this database. By default, there are several tables and a lot of views and stored procedures.
3. Write in Web. config
-
XML Code
-
<sessionState mode="SQLServer" sqlConnectionString="server=127.0.0.1; database=StudentSession ;uid=sa ;pwd=7654321;" allowCustomSqlDatabase="True" cookieless="false" timeout="20" />
Do not understand the e-mail to me: woodynet@qq.com
After executing these operations, you will automatically perform operations on the database for the session operation.
Since it is automatic, you don't have to worry about it, how to insert, and how to delete it when you exit.
It is automatically completed.