The requested operation cannot be performed on a file with a user-mapped section open.

I am trying to perform a simple File.Copy()

        string _originalFile = "Lapdesk.Websites/Files/Lapdesk_Quote_Original.xls";
        string _destFile = "Lapdesk.Websites/Files/Lapdesk_Quote.xls";
   
       //Generatate copy of original and modify.
       File.Copy(_originalFile, _destFile, true);

When the above mentioned error is generated.  The files are not open and no background proceses are running that can access them
pvrooyenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

galar71Commented:
Have you checked if you have all the appropriate permissions for the folder and the file?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
galar71Commented:
I would also make sure that no other program is using the file you are trying to copy. Worst case, log off and log back on, and retry (as long as it's not on a network and somebody else might have it open). This might also do the trick.

I'm not entirely certain why you get the error, but I believe it's a locking or permission issue, albeit a somewhat obscure one.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.