Unable to delete PDF file

Jiang, Xiaoyang 1 Reputation point
2022-11-23T06:15:07.88+00:00

I open a PDF file in brower which is downloaded from server.
I want to delete the PDF file when I click the "X" button of browser, so I use 【file.Delete()】 of C# program ("file" is FileInfo() type) to delete the PDF file. But it not always works, sometimes the PDF file cannot be deleted and the browser has no corresponding.

If I close the browser, and open the folder where the PDF is locating, delete it in windows menu, then it will load all the time(the pic below) until restart the PC.

I want to know what happens to the PDF file?How can I delete it with C#?

263217-freeze.png

Developer technologies C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiang, Xiaoyang 1 Reputation point
    2022-11-23T07:00:23.367+00:00

    Next, if I double click the PDF files, Adobe Reader will be open and show the message below. Yes, the file is deleted.

    263328-deleted.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.