WebBrowser.Navigate(...) throws COMException
Asked Answered
T

2

8

I'm developing an Internet Explorer command button that will open a specific web page once clicked. Here's a snippet of code (IEApp is a reference to an instance of IE.WebBrowser):

IEApp.Navigate(sURL, ref one, ref two, ref three, ref four);

The above line throws the following COMException:

Exception Source:      Interop.SHDocVw
Exception Type:        System.Runtime.InteropServices.COMException
Exception Message:     The requested resource is in use. (Exception from HRESULT: 0x800700AA)
Exception Target Site: Navigate

This wasn't a problem on IE6 or IE7. Any ideas on what's going wrong? I'm using AddInExpress for creating the command button.

Cheers! Christian

Tagmeme answered 9/2, 2010 at 17:14 Comment(3)
Can you run your app with Fiddler? This thread (forums.iis.net/t/1146952.aspx) suggests that the problem might not be on the client side and you might be getting an HTTP 500 back from the server.Apperception
Unfortunately, there's no activity to be seen in Fiddler. But the error message is almost instant. Also, I'm curious as to what "The requested resource is in use" implies. I can see that the busy-property if true, but the browser is really doing nothing.Tagmeme
It could be the issue mentioned hereIncontinent
K
5

That's ERROR_BUSY usually happens when IE is doing something else, e.g. displaying a window.alert message box.
Try suppress script errors and Implement IDocHostShowUI and return S_OK without blocking the message pump

Kori answered 10/2, 2010 at 3:8 Comment(7)
The current URL is about:blank, also when checking the property on the IE.WebBrowser so I don't think it's actually doing anything.Tagmeme
what is the return value of IWebBrowser2::get_ReadyStatePistareen
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.Pistareen
Adding an IEApp.Stop(); before the Nagivate, doesn't change the outcome, I'm afraid.Tagmeme
what is the value of IWebBrowser2::get_Busy?Pistareen
It says 'true', even right after I do a .Stop(); This is the code: string sURL; System.Object one = null; System.Object two = null; System.Object three = null; System.Object four = null; sURL = "google.dk"; IEApp.Stop(); MessageBox.Show(IEApp.Busy.ToString()); IEApp.Navigate(sURL, ref one, ref two, ref three, ref four);Tagmeme
where is this code in? if it is button click then disable the button when the busy property is true.Pistareen
P
1

could this help: turning off UAC in Windows, if you are using a server kind version:

screen-shoots here: http://blog.vincentbrouillet.com/post/2011/02/10/watin%3A-The-requested-resource-is-in-use

I had this error, and it was quite random. I tried killing IE before running the tests. It kind of work, but not all the time.

Positronium answered 10/2, 2011 at 6:18 Comment(2)
Nah, can't ask clients to disable UAC. See my solution below.Tagmeme
@ChrispedDK : I am also looking for solution for this problemBolster

© 2022 - 2024 — McMap. All rights reserved.