Session 失灵原因
Session 失效原因 转载http://blog.csdn.net/LLorJJ999/article/details/4107464 昨天去GTSC面试,有面试官问我关于Session丢失之后怎么查的问题,说老实话,开发到现在很少碰到这样的情况,唯一想到的就是Session超时,还有就是做Session读写日志,发觉面试
Session 失效原因
转载http://blog.csdn.net/LLorJJ999/article/details/4107464
昨天去GTSC面试,有面试官问我关于Session丢失之后怎么查的问题,说老实话,开发到现在很少碰到这样的情况,唯一想到的就是Session超时,还有就是做Session读写日志,发觉面试官听了之后不是很满意,汗!
不管怎么说,是个学习的好机会,今天抽空查了一下网上关于这些问题的处理方法,总结一下,希望对大家有所帮助。
顺便提一下asp中Session的工作原理:
asp的Session是具有进程依赖性的。ASP Session状态存于IIS的进程中,也就是inetinfo.exe这个程序。所以当inetinfo.exe进程崩溃时,这些信息也就丢失。另外,重起或者关闭IIS服务都会造成信息的丢失。
asp.net Session的实现
asp.net的Session是基于HttpModule技术做的,HttpModule可以在请求被处理之前,对请求进行状态控制,由于Session本身就是用来做状态维护的,因此用HttpModule做Session是再合适不过了。
原因1:
bin目录中的文件被改写,asp.net有一种机制,为了保证dll重新编译之后,系统正常运行,它会重新启动一次网站进程,这时就会导致Session丢失,所以如果有access数据库位于bin目录,或者有其他文件被系统改写,就会导致Session丢失
原因2:
文件夹选项中,如果没有打开“在单独的进程中打开文件夹窗口”,一旦新建一个窗口,系统可能认为是新的Session会话,而无法访问原来的Session,所以需要打开该选项,否则会导致Session丢失
参考配置:
http://jingyan.baidu.com/article/22fe7ced78594f3002617f04.html
原因3:
似乎大部分的Session丢失是客户端引起的,所以要从客户端下手,看看cookie有没有打开
原因4:【本文来自鸿网互联 (http://www.68idc.cn)】
Session的时间设置是不是有问题,会不会因为超时造成丢失
原因5:
IE中的cookie数量限制(每个域20个cookie)可能导致session丢失
原因6:
使用web garden模式,且使用了InProc mode作为保存session的方式
解决丢失的经验
1. 判断是不是原因1造成的,可以在每次刷新页面的时候,跟踪bin中某个文件的修改时间
2. 做Session读写日志,每次读写Session都要记录下来,并且要记录SessionID、Session值、所在页面、当前函数、函数中的第几次Session操作,这样找丢失的原因会方便很多
3. 如果允许的话,建议使用state server或sql server保存session,这样不容易丢失
4. 在global.asa中加入代码记录Session的创建时间和结束时间,超时造成的Session丢失是可以在SessionEnd中记录下来的。
5. 如果有些代码中使用客户端脚本,如javascript维护Session状态,就要尝试调试脚本,是不是因为脚本错误引起Session丢失
- 1楼arg
- php目录下你和我谈asp 的session失效?,asp asp.net 分不清。,转载来弄这么个破玩意。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Why does wireless screencasting fail to connect? Some friends have reported that the connection fails when using wireless screen mirroring. What is going on? What should I do if the wireless screen mirroring connection fails? Please confirm whether your computer, TV and mobile phone are connected to the same WiFi network. Screen mirroring software requires devices to be on the same network to work properly, and Quick Screen Mirroring is no exception. Therefore, please quickly check your network settings. It is important to determine whether the screen mirroring function is supported. Smart TVs and mobile phones usually support DLNA or AirPlay functionality. If the screencast function is not supported, screencasting will not be possible. Confirm whether the device is connected correctly: There may be multiple devices under the same WiFi. Make sure you are connecting to the device you want to share the screen with. 4. Ensure that the network

When connecting a printer to a local area network and starting a print job, some minor problems may occur. For example, the problem "wpsoffice cannot start the print job..." occasionally occurs, resulting in the inability to print out files, etc., delaying our work and study, and causing a bad impact. , let me tell you how to solve the problem that wpsoffice cannot start the print job? Of course, you can upgrade the software or upgrade the driver to solve the problem, but this will take you a long time. Below I will give you a solution that can be solved in minutes. First of all, I noticed that wpsoffice cannot start the print job, resulting in the inability to print. To solve this problem, we need to investigate one by one. Also, make sure the printer is powered on and connected. Generally, abnormal connection will cause

A Comprehensive Guide to PHP 500 Errors: Causes, Diagnosis, and Fixes During PHP development, we often encounter errors with HTTP status code 500. This error is usually called "500InternalServerError", which means that some unknown errors occurred while processing the request on the server side. In this article, we will explore the common causes of PHP500 errors, how to diagnose them, and how to fix them, and provide specific code examples for reference. Common causes of 1.500 errors 1.

Session failure is usually caused by the session lifetime expiration or server shutdown. The solutions: 1. Extend the lifetime of the session; 2. Use persistent storage; 3. Use cookies; 4. Update the session asynchronously; 5. Use session management middleware.

The mouse is an essential device when we use computers. Whether the mouse is easy to use is also directly related to our operating experience, work efficiency and gaming experience. The left mouse button is used most frequently. How to solve the problem of left mouse button failure and insensitivity? Let's look at the solution. Solution 1: The left mouse button temporarily fails after turning on the computer. 1. Open the task manager. If the mouse can be used in the future, it is a mouse problem! This is a system process problem - conime.exe problem! The conime.exe process, usually just started and only for a while, is an input editor that allows the user to enter complex characters and symbols using a standard keyboard. Turn it off and Chinese characters cannot be entered. If you don't want this process you can disable

I believe many friends have encountered the problem of system blue screen, but I don’t know what is the cause of win11 blue screen. In fact, there are many reasons for system blue screen, and we can investigate and solve them in order. Reasons for win11 blue screen: 1. Insufficient memory 1. It may occur when running too many software or the game consumes too much memory. 2. Especially now there is a memory overflow bug in win11, so it is very likely to be encountered. 3. At this time, you can try to set up virtual memory to solve the problem, but the best way is to upgrade the memory module. 2. CPU overclocking and overheating 1. The causes of CPU problems are actually similar to those of memory. 2. It usually occurs when using post-processing, modeling and other software, or when playing large-scale games. 3. If the CPU consumption is too high, a blue screen will appear.

Some users may encounter slow charging speeds when using Apple phones. There are many reasons for this problem. It may be caused by low power of the charging device, device failure, problems with the USB interface of the mobile phone, or even battery aging and other factors. Why does Apple mobile phone charge very slowly? Answer: charging equipment problem, mobile phone hardware problem, mobile phone system problem. 1. When users use charging equipment with relatively low power, the charging speed of the mobile phone will be very slow. 2. Using third-party inferior chargers or charging cables will also cause slow charging. 3. It is recommended that users use the official original charger, or replace it with a regular certified high-power charger. 4. There is a problem with the user’s mobile phone hardware. For example, the USB interface of the mobile phone cannot be contacted.

Solution to the cross-domain problem of PHPSession In the development of front-end and back-end separation, cross-domain requests have become the norm. When dealing with cross-domain issues, we usually involve the use and management of sessions. However, due to browser origin policy restrictions, sessions cannot be shared by default across domains. In order to solve this problem, we need to use some techniques and methods to achieve cross-domain sharing of sessions. 1. The most common use of cookies to share sessions across domains
