Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Shawn - 18 Feb 2006 18:14 GMT
Well, the subject sais it all.  What is the best approach to prevent this
from happening?

Thanks,
Shawn
Elton W - 19 Feb 2006 00:07 GMT
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

> Well, the subject sais it all.  What is the best approach to prevent this
> from happening?
>
> Thanks,
> Shawn
Elton W - 19 Feb 2006 03:11 GMT
you can also use Singleton class.

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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.