Prevent two users from accessing the same file at the same time

  • Thread starter Thread starter Shawn
  • Start date Start date
S

Shawn

Well, the subject sais it all. What is the best approach to prevent this
from happening?

Thanks,
Shawn
 
Hi Shawn,

You can setting a flag in an ApplicationState, e.g.
Application["fileAccessed"]. In Application_Start set it as false,

Application["fileAccessed"] = false;

Only when it's false to allow to access and shift it to true and also set a
flag in Session. Once finish accessing the file to shift Application flag to
false and delete Session flag. Or in Session_End to check Session flag,
accordingly shift Application flag.

HTH

Elton Wang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top