webbrowser control locks a file cannot delete

  • Thread starter Thread starter Sameer
  • Start date Start date
S

Sameer

Hi

I have a windows form application and am using WebBrowser control to display
a PDF document. The problem is that it will display the PDF file just fine
however, when i try to delete the file it complains of Sharing violation as
file is locked by Web Browser control.

How do I release the file?

Please help!

-Sam
 
Sam,

I would say that it is not the web browser specifically that is locking
it, but rather, the adobe acrobat reader that is doing it.

Needless to say, it doesn't really matter, since the file is locked.

You could monitor when the page navigates away from the PDF, and then
try to delete it. You should be able to delete it then.

Either that, or keep a list of documents that you are viewing locally
that need to be deleted, and delete them when the app shuts down.

Hope this helps.
 
Back
Top