Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Locking File

    Hello,

    I am opening a file like below:
    FileStream fs =
    File.Open(Server.MapPath("../Data/REFCOD.txt"),FileMode.Open,FileAccess.Writ
    e,FileShare.None);

    ---------------------------------------------------------
    I do not want anyone to access the file while it is opened.
    ---------------------------------------------------------


    My question is:
    If another request tries to open this file while it is opened will the
    request wait untill it can open it and then proceed with its operation or
    will an exception be generated?

    I'm hopeing that it will wait untill it can open it and then will.
    If not is there a way todo so with out generating an exception?


    Thanks,
    Ron Vecchi


    Ron Vecchi Guest

  2. Similar Questions and Discussions

    1. File locking in XP
      The issue i'm experiencing may be more related to XP Pro than with Illustrator itself, but it only seems to be affecting Illustrator EPS files... ...
    2. Win 2K3 & File Locking
      Anyone aware of file locking issues specific to Perl on Windows 2003 server?
    3. File locking for all my needs
      I thought this could be usefull to someone but before you use it bear in mind its limitations, - probably works as expected only on Linux and...
    4. Confused about locking a file via file.flock(File::LOCK_EX)
      I am writing a ruby appl under AIX where I need to update the /etc/hosts table. I would like to make sure that during my update nobody else can...
    5. file locking
      Hi All, There are 3 different file locking mechanisms in C: flock lockf fcntl I want to write a Ruby script, which shares files with a C...
  3. #2

    Default Re: Locking File

    execption thrown

    "Ron Vecchi" <vencenzo@comcast.net> wrote in message
    news:OB7IeQUUDHA.2008@TK2MSFTNGP11.phx.gbl...
    > Hello,
    >
    > I am opening a file like below:
    > FileStream fs =
    >
    File.Open(Server.MapPath("../Data/REFCOD.txt"),FileMode.Open,FileAccess.Writ
    > e,FileShare.None);
    >
    > ---------------------------------------------------------
    > I do not want anyone to access the file while it is opened.
    > ---------------------------------------------------------
    >
    >
    > My question is:
    > If another request tries to open this file while it is opened will the
    > request wait untill it can open it and then proceed with its operation or
    > will an exception be generated?
    >
    > I'm hopeing that it will wait untill it can open it and then will.
    > If not is there a way todo so with out generating an exception?
    >
    >
    > Thanks,
    > Ron Vecchi
    >
    >

    bruce barker Guest

  4. #3

    Default Re: Locking File

    Rats,



    "bruce barker" <nospam_brubar@safeco.com> wrote in message
    news:%23yAANlUUDHA.2420@TK2MSFTNGP10.phx.gbl...
    > execption thrown
    >
    > "Ron Vecchi" <vencenzo@comcast.net> wrote in message
    > news:OB7IeQUUDHA.2008@TK2MSFTNGP11.phx.gbl...
    > > Hello,
    > >
    > > I am opening a file like below:
    > > FileStream fs =
    > >
    >
    File.Open(Server.MapPath("../Data/REFCOD.txt"),FileMode.Open,FileAccess.Writ
    > > e,FileShare.None);
    > >
    > > ---------------------------------------------------------
    > > I do not want anyone to access the file while it is opened.
    > > ---------------------------------------------------------
    > >
    > >
    > > My question is:
    > > If another request tries to open this file while it is opened will the
    > > request wait untill it can open it and then proceed with its operation
    or
    > > will an exception be generated?
    > >
    > > I'm hopeing that it will wait untill it can open it and then will.
    > > If not is there a way todo so with out generating an exception?
    > >
    > >
    > > Thanks,
    > > Ron Vecchi
    > >
    > >
    >
    >

    Ron Vecchi Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139