How can i solve this error " The requested resource is in use. (Exception from HRESULT: 0x800700AA)". This appear while navigating to different website using WebBrowser control in C#.net. can i know why? Thanks
A:
bool go = false;
string SiteContent1 = string.Empty;
string SiteContent2 = string.Empty;
int index = 0;
WebBrowser wb = new WebBrowser();
void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
try
{
if (go)
{
SiteContent2 = wb.DocumentText;
// Code to compare to contents of the webbrowser
index++;
go = false;
steps = 1;
}
if (!go)
{
if (index >= TotalSiteCount)
{
Stop();
}
else if (steps == 1)
{
wb.Navigate(UrltocompareList[index].Url1);
}
else if (steps == 2)
{
SiteContent1 = wb.DocumentText;
wb.Navigate(UrltocompareList[index].Url2);
go = true;
}
steps++;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
UrltocompareList is a collection of 2 sites to compare.
TotalSiteCount is the number of items in UrltocompareList.
The form for this inherit IOleClientSite to remove media such as images, videos and no active X download to have a faster rendering time in webbrowser control.
I use this method instead of system.net.webclient to get the html of a webpage then compare them.
I got this error when it hits the wb.Navigate method.
Jepe d Hepe
2010-02-04 04:15:24
please edit the question if you have more information
Sheng Jiang 蒋晟
2010-02-06 19:54:45
+1
A:
try stop the current navigation (if you indeed want to stop when the page is not completed loaded) or add the navigation to a request queue and use a timer to wait IWebBrowser2::get_Busy returns false.
Sheng Jiang 蒋晟
2010-02-10 15:41:21