Error writing to .csv file
Posted on 2012-03-22
Hi I have some code which goes round in a loop and writes to a .csv file. This all works perfectly on my laptop (Vista and Visual Web Developer Express). However, to my horror when I copied the files across to my client's server (running Windows 2008) I got the following error message:
The process cannot access the file 'C:\inetpub\wwwroot\DR\Admin\uploaded\35201203211547.csv' because it is being used by another process.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
I then closed down the browser and attempted to manually delete the file using Windows Explorer but it wouldn't let me delete it and gave me this message:
File in Use
The action can't be completed because the file is open in IIS Worker Process.
No-one else was accessing the website while I was on it so how on earth could the file have been used by another process?? Please someone help as this is very embarassing for me!