In some special systems, only one person can modify the system data at the same time. When others modify the data, the data is in the "Lock" status, only when the person Who modifies the data exits can others modify the data.
By setting a global switch variable (application), when the first user modifies the data, the variable is set to a value indicating the lock status (such as lock ), before other users modify the data, check whether the modification can be made. Generally, the modification permission is released in several cases (the variable is set to unlock)
1. the user who modified the data exited the system.
2. Users who modify data do not operate for a long time
3. Disable IE for users who modify data
In the first case, you can click "exit;
In the second case, if you do not perform operations for a long time, we can process them in the session_end event. The specific time length can be set in Web. config.
(The trigger condition of the session_end event. session. Abandon () or a long time when no operation is performed can trigger this event)
In the third case, if you do not handle this situation, the application object is not always locked. After IE is closed, the session_end event can still be triggered, that is, the system will wait until the session_end event is triggered to release the resource, but this is not very good. If the time for triggering the session_end event is 1 hour... in this case, we can add JavaScript to the lower part of the page. When the user closes the page, the page jumps to a page that handles the exit and closes the page immediately after processing.
Function window_onunload (){
{
If (event. clientx <0 & event. clienty <0)
Export export open('29140.html ', '', 'toolbar = No, location = No, directories = No, status = No, menubar = No, scrollbars = Yes, resizable = No, top = 2000, left = 2000, width = 0, Height = 0 ');
}
On the logout. ASPX page, unlock the application variable.
This problem also exists in some other applications, such as the real-time online user list of websites.