Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the causes of Session failure and loss

2025-04-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the relevant knowledge of "how to solve the causes of Session failure and loss". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

By the way, how Session works in asp:

Asp's Session is process dependent. The ASP Session state is stored in the IIS process, that is, the inetinfo.exe program. So when the inetinfo.exe process crashes, this information is lost. In addition, restarting or shutting down the IIS service will result in the loss of information.

The realization of asp.net Session

The Session of asp.net is based on HttpModule technology. HttpModule can control the state of the request before it is processed. Because Session itself is used for state maintenance, it is more appropriate to use HttpModule as Session.

Reason 1:

The files in the bin directory are rewritten, and asp.net has a mechanism. In order to ensure that the system runs normally after dll is recompiled, it will restart the website process, which will lead to the loss of Session, so if an access database is located in the bin directory, or if other files are rewritten by the system, it will cause Session loss.

Reason 2:

In the folder option, if you do not open the "Open folder window in a separate process", once you create a new window, the system may think that it is a new Session session and cannot access the original Session, so you need to turn on this option, otherwise it will cause Session loss.

Reference configuration:

Http://jingyan.baidu.com/article/22fe7ced78594f3002617f04.html

Reason 3:

It seems that most of the Session loss is caused by the client, so start from the client to see if the cookie is open.

Reason 4:

Is there something wrong with the time setting of Session? will it be lost due to timeout?

Reason 5:

The limit on the number of cookie in IE (20 cookie per domain) may result in session loss

Reason 6:

Uses web garden mode and uses InProc mode as a way to save session

Dealing with lost experience

1. To determine whether it is caused by cause 1, you can track the modification time of a file in bin each time the page is refreshed.

two。 Do Session read and write log, record every time you read and write Session, and record SessionID, session value, page, current function, and the third in the function.

Several Session operations, it will be much more convenient to find the cause of the loss.

3. If allowed, it is recommended to use state server or sql server to save session, so that it is not easy to lose

4. Add code to global.asa to record the creation time and end time of Session, and the loss of Session caused by timeout can be recorded in SessionEnd.

5. If some code uses client script, such as javascript to maintain Session state, try to debug the script. Is the Session lost due to script errors?

This is the end of the content of "how to solve the causes of Session failure and loss". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 282

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report