File.Copy : The process cannot access the file because it is being used by another process.  (Using ASP.NET and VB.NET)

Posted on 2004-10-26
Last Modified: 2012-08-13
Using ASP.NET and VB.NET

When I attempt:

       File.Copy(strSource, strFileName, True)

I get this error:  The process cannot access the file "\\SERVER\www-folder$\Menu\Xml\myMenu.xml" because it is being used by another process.

I am running ASP.NET on IIS 5 with .NET Framework 1.1

I am really stuck...  Any help would be nice.
Question by:afsanchez001
    LVL 9

    Accepted Solution

    Make sure that any code that edits / opens the resource in question explicitely CLOSE it when you are finished working with the file before moving or deleting it with the code specified.
    LVL 8

    Assisted Solution

    Looks like a web server folder - is the indexing service running and indexing that folder? That would do it.

    You may also have a rights issue.
    LVL 96

    Assisted Solution

    by:Bob Learned
    Yeah, it does sound like a rights issue, which is common with ASP.NET, since a lot of people don't realize all the goes into security.


    Author Comment

    You guys ROCK!!!

    Expert Comment

    Hi All,
    I am wondering what actually resolved this problem.  Was the problem really resolved?  I have a similar problem inside a windows service.  Any help is appreciated.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    846 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now