webbrowser control locks a file cannot delete

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sameer

    #1

    webbrowser control locks a file cannot delete

    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


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: webbrowser control locks a file cannot delete

    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.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Sameer" <sbshah@netflix .com> wrote in message
    news:uC$aKx5JGH A.524@TK2MSFTNG P09.phx.gbl...[color=blue]
    > 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
    >[/color]


    Comment

    Working...