Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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 24-Jun-13 22:02pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 400
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 25 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100