Click here to Skip to main content
15,897,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,
Is there any process of locking the screen c# web application? for example some one open the page for edit/updating, if at the same time some other person if open the same page it should be in read only mode and it will alert the use that some one updating the page....
Posted

1 solution

The simple answer is yes. But it's a bit more complicated than that.

You're talking about record locking for which there are two main types. Pessimistic and Optimistic

Pessimistic is used to forcible stop someone editing a record. This is the type of locking you're asking about.

Optimistic is used when the record is saved. If the record has been changed since the user loaded it it needs to managed.

When hosting a website in IIS often you will use a technique called web gardening to get better performance for your website.

This means IIS will create multiple processes all of which are ignorant of each other because they don't share the same application memory space.

You therefore can't set a flag indicating the form is locked in memory. You have to find out of process storage to achieve this.

The simplest option is to create a table for managing which forms are locked. Update the table when a user locks and again when unlocks.

Then check the database when a user requests and edit and use this data to manage the response.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900