473,414 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

WebBrowser problem

I am using the AxSHDocVw.AxWebBrowser control (named PreviewBrowser) in my C#
app to load a pdf file:

PreviewBrowser.Navigate(strPDF ,ref objNull,ref objNull,ref objNull,ref
objNull);
These PDF files are created and stored in a temp folder. The older files
from temp need to be deleted everytime prior to calling the Navigate function
for the current file.

But I am getting an exception when i try to delete the temp folder
(containing the older pdf files)
"The process cannot access the file "xxx.pdf" because it is being used by
another process."

Is there any property/setting for the WebBrowser control to free up the file??
Apr 5 '07 #1
3 3155
Just a suggestion, use System.Net.WebClient instead of
AxSHDocVw.AxWebBrowser.

Otherwise, try performing an Application.DoEvents() loop until the
document's readyState is Complete. Not sure if that works or not.

Jon

"Gaurav" <Ga****@discussions.microsoft.comwrote in message
news:9B**********************************@microsof t.com...
>I am using the AxSHDocVw.AxWebBrowser control (named PreviewBrowser) in my
C#
app to load a pdf file:

PreviewBrowser.Navigate(strPDF ,ref objNull,ref objNull,ref objNull,ref
objNull);
These PDF files are created and stored in a temp folder. The older files
from temp need to be deleted everytime prior to calling the Navigate
function
for the current file.

But I am getting an exception when i try to delete the temp folder
(containing the older pdf files)
"The process cannot access the file "xxx.pdf" because it is being used by
another process."

Is there any property/setting for the WebBrowser control to free up the
file??

Apr 5 '07 #2
Jon,

We are using AxSHDocVw.AxWebBrowser extensively in our app, so using another
browser component is not an option.
Application.DoEvents() doesn't work.

Thanks for the suggestions.

"Jon Davis" wrote:
Just a suggestion, use System.Net.WebClient instead of
AxSHDocVw.AxWebBrowser.

Otherwise, try performing an Application.DoEvents() loop until the
document's readyState is Complete. Not sure if that works or not.

Jon

"Gaurav" <Ga****@discussions.microsoft.comwrote in message
news:9B**********************************@microsof t.com...
I am using the AxSHDocVw.AxWebBrowser control (named PreviewBrowser) in my
C#
app to load a pdf file:

PreviewBrowser.Navigate(strPDF ,ref objNull,ref objNull,ref objNull,ref
objNull);
These PDF files are created and stored in a temp folder. The older files
from temp need to be deleted everytime prior to calling the Navigate
function
for the current file.

But I am getting an exception when i try to delete the temp folder
(containing the older pdf files)
"The process cannot access the file "xxx.pdf" because it is being used by
another process."

Is there any property/setting for the WebBrowser control to free up the
file??


Apr 5 '07 #3
We are using AxSHDocVw.AxWebBrowser extensively in our app, so using
another
browser component is not an option.
System.Net.WebClient is not a browser component. It just performs an HTTP
query to fetch the document and put the file wherever you want it. I use
AxSHDocVw.AxWebBrowser, too, but for situations similar to yours there is no
harm in using other components.

If the user is clicking on the a link to the odcument, use the
DownloadComplete event. If you're using .NET 2.0, try using the
System.Windows.Forms.WebBrowser, which is a wrapper of
AxSHDocVw.AxWebBrowser, and then use the DocumentStream property after
DocumentComplete event finishes to read the stream out to a file, or look
for the DocumentStream equivalent in AxSHDocVw.AxWebBrowser.

Jon

"Gaurav" <Ga****@discussions.microsoft.comwrote in message
news:0D**********************************@microsof t.com...
Jon,

We are using AxSHDocVw.AxWebBrowser extensively in our app, so using
another
browser component is not an option.
Application.DoEvents() doesn't work.

Thanks for the suggestions.

"Jon Davis" wrote:
>Just a suggestion, use System.Net.WebClient instead of
AxSHDocVw.AxWebBrowser.

Otherwise, try performing an Application.DoEvents() loop until the
document's readyState is Complete. Not sure if that works or not.

Jon

"Gaurav" <Ga****@discussions.microsoft.comwrote in message
news:9B**********************************@microso ft.com...
>I am using the AxSHDocVw.AxWebBrowser control (named PreviewBrowser) in
my
C#
app to load a pdf file:

PreviewBrowser.Navigate(strPDF ,ref objNull,ref objNull,ref objNull,ref
objNull);
These PDF files are created and stored in a temp folder. The older
files
from temp need to be deleted everytime prior to calling the Navigate
function
for the current file.

But I am getting an exception when i try to delete the temp folder
(containing the older pdf files)
"The process cannot access the file "xxx.pdf" because it is being used
by
another process."

Is there any property/setting for the WebBrowser control to free up the
file??



Apr 5 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matthias Huening | last post by:
Hi, os.startfile('http://www.python.org') works fine on WinXP with IE as default webbrowser. With Mozilla Firefox 0.9 as default webbrowser, however, I get an error. Firefox starts, the page...
2
by: Miguel | last post by:
Hi, I'm developing an application in C# with Windows Forms for my company that is similar to the MSN Messenger. This application uses a webservice for registering users, etc... and as 2...
5
by: SPE - Stani's Python Editor | last post by:
Hi, During optimizing SPE for Ubuntu, I found something strange. I have Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not working: >>> import webbrowser >>>...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
8
by: Prosperz | last post by:
Hi, I would like to make thumbnails of web page by capture content of a WebBrowser. By example, capture http://www.google.com. I used WebBrowser control with Framework 2.0. I try this : ...
5
by: mabond | last post by:
Hi recently read a posting and reply about Excel processs still running after the Appliction.Quit was called. Thought I might be able to use the same...
4
by: Robson Siqueira | last post by:
Folks, I am facing a problem. I am trying to manipulate the HTML data (thru the Document and DocumentText properties) of the WebBrowser object (System.Windows.Forms). The problem is that the...
4
by: kimiraikkonen | last post by:
Hi, Just to test, i placed a simple webbrowser to login a site, this site has no problems and has same error with IE6 SP2 but it's suppressed as well and no problem with Firefox browser, but using...
11
by: kimiraikkonen | last post by:
Hi there, I needed to use MouseOver event on Webbrowser which is NOT provided by webbrowser control natively(what a disappointment), so i decided to go with another route to simulate this like: ...
3
by: TedTrippin | last post by:
Hi, Background - I've create a windows application in VS and added a WebBrowser component and all works well. I'm now trying to do this programmatically. My application now listens on a socket...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.