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

Discussion in 'ASP .Net' started by Shawn, Feb 18, 2006.

  1. Shawn

    Shawn Guest

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

    Thanks,
    Shawn
    Shawn, Feb 18, 2006
    #1
    1. Advertising

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


    "Shawn" wrote:

    > Well, the subject sais it all. What is the best approach to prevent this
    > from happening?
    >
    > Thanks,
    > Shawn
    >
    >
    >
    =?Utf-8?B?RWx0b24gVw==?=, Feb 19, 2006
    #2
    1. Advertising

  3. you can also use Singleton class.


    "Shawn" wrote:

    > Well, the subject sais it all. What is the best approach to prevent this
    > from happening?
    >
    > Thanks,
    > Shawn
    >
    >
    >
    =?Utf-8?B?RWx0b24gVw==?=, Feb 19, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. darrel
    Replies:
    2
    Views:
    470
    darrel
    Apr 5, 2006
  2. Replies:
    8
    Views:
    691
  3. id10t error
    Replies:
    3
    Views:
    728
    Alexey Smirnov
    Aug 31, 2009
  4. JP SIngh

    Prevent users from accessing files

    JP SIngh, Apr 14, 2005, in forum: ASP General
    Replies:
    4
    Views:
    138
    Kyle Peterson
    Apr 15, 2005
  5. John Smith
    Replies:
    1
    Views:
    112
    William Herrera
    Nov 29, 2003
Loading...

Share This Page