ForumUnansweredBonus QuestionsArticlesFAQsSearchContestMy AccountSign-out The process cannot access the file because it is being used by anotherAsked By dev rathore on 28-May-12 02:14 AMHi All,
I have used below code to delete temp file(.PDF) in ASP.net 4.0.
but gettting below error:
The process cannot access the file 'D:\devendra\web\TempWorkAreaPdf\AdmitCard_C58YE26SB7.pdf' because it is being used by another process.
Please help me so that i can delete the tempfile.
The chances are it is your code that is using the file: check where you create and use the temporary file, and ensure that you have correctly Closed and Disposed all file streams and related objects when you have finished with it. Just letting them go out of scope does not do this - it waits for the Garbage collector to do it which may not be for weeks!
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)