Locking File

R

Ron Vecchi

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
 

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

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top