|
Rank: Newbie Groups: Member
Joined: 8/3/2021 Posts: 3
|
Hello. I have a EO.WebBrowser.WebView that seems to freeze when downloading. It doesn't happen in patterns. It will go along and download a dozen, but then sometimes the first one will download fine, then the second or subsequent file will not download.
Someone in this forum mentioned destroying the webview when I'm done downloading. That seems to help, but it still hangs up.
In one post, someone suggested to trap for the DownloadUpdated event and call e.Item.Cancel(); However the DownloadUpdated event never fires.
I saw another post which says, "If the server does not send the total size of the file, then the browser engine can not calculate the progress thus it does not trigger DownloadUpdated event."
We are downloading PDFs from a county government website, so their server may not be sending the file size...
So how can I cancel a download if it's obviously hung up?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
I am not exactly sure how you start the download or whether you receive BeforeDownload event. Regardless, the basic idea is to see if you receive DownloadUpdated event within a certain amount time (for example, 1 minute) after the download starts. If you do not receive DownloadUpdated event within that time frame, then most likely it hung somewhere. In that case you can destroy the WebView and recreate it. There are several different scenarios as to determine when the download starts:
1. If you receive BeforeDownload event, then you can use that event to determine when the download starts; 2. If you start the download programmatically, then your code would know when the download starts; 3. If the download is triggered by user clicking a link (but you do not receive BeforeDownload event), then you can write additional code to check BeforeResourceLoad event to find out when the download starts;
Another thing you want to check is how many concurrent download you already have. Chromium like all browser has an internal limits on how many connections per server. When that limit is reached, the new download will not proceed until a connection is "freed".
Whether the server sends back the total size does not impact download jobs. It only makes it impossible to display download progress. However it should not prevent the download from starting.
In any case, it would be very helpful if you can find a way to reproduce the problem. This is the only reliable way to get to the bottom of such issues. Otherwise we would all be shooting in the dark and it is unlikely we will hit any meaningful target.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 8/3/2021 Posts: 3
|
|
|
Rank: Newbie Groups: Member
Joined: 8/3/2021 Posts: 3
|
Thank you. I simply call WebView2.Download(PDFFile, DestFile); WebView2 is created in WebView1_NewWindow() because the javascript link that gets us to the page forces to open in a new page. The BeforeDownload event never fires. The code works most of the time, but occasionally it hangs up.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, You can try the steps we outlined in our previous reply. And if that still does not work, please try to isolate the problem into a test project and send the test project to us. See here for more details: https://www.essentialobjects.com/forum/test_project.aspxOnce we have that we will debug it here and see what we can find. Thanks!
|
|