webbrowser control locks a file cannot delete

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top