In ASP. NET, only one person can modify system data at a time.

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.