- 3 minutes to read
The current approach implemented by DevExpress Office Controls for storing all open documents in server memory (in a list maintained by the DocumentManager) does not prevent scenarios in which the same document is opened by multiple browser clients at the same time.
These situations may occur in the following cases.
A document is opened from a common shared document folder on the server file system (this folder is specified using the WorkDirectory property of an office control). Multiple users open the same document file specified by its server path - its location within the shared folder.
You can use the File Open dialog in the office control’s UI at runtime, or utilize an API in which the Open method accepts pathToDocument as a parameter.
Specify the DocumentId to open a document directly from the server’s in-memory storage of open documents (DocumentManager).
var documentId = GetSharedDocumentId(); var documentInfo = (SpreadsheetDocumentInfo)DocumentManager.FindDocument(documentId); ASPxSpreadsheet1.Open(documentInfo);
An office control’s Open method only receives the IDocumentInfo class descendant that is cast for a specific type as a parameter (SpreadsheetDocumentInfo and RichEditDocumentInfo, respectively).
If this code is called with the same DocumentId by different application users, changes made by these users are applied to a single, shared document on the server.
Currently, if multiple users work with the same document, the DevExpress office control UI does not reflect changes made by other users. An end user may need to refresh the web page to see these changes.
Document sharing may cover scenarios in which an end user starts working with a document on one computer (e.g., a desktop) and then continues his/her work on another computer (e.g., a tablet). In this case, changes are not lost when the user switches between devices. Note, however, that changes may be lost when multiple users collaborate on or co-author a document.
To learn more about document sharing, refer to the following Knowledge Base articles.
- How open documents are shared between users in Spreadsheet/RichEdit
- Spreadsheet and RichEdit controls - Collaboration Limitations
Prevent Document Sharing
To disable document sharing, use the following approaches.
If documents are opened from the server’s file system, divide user documents into different work folders (specified by the WorkDirectory property) for different users (user accounts).
If documents are opened from a custom document storage (e.g., a database), implement custom logic that checks and prevents requests from different users (user accounts) with the same DocumentId to a database document object.