System.Windows.Forms.WebBrowser not working

S

sonicwrx

Am I missing something?

I have a form with a browser control and a button. The code under the
button is:

private void btnGo_Click(object sender, EventArgs e)
{
wbScrape.Navigate(@"http://
www.google.com");
}

The browser just displays the message:
Navigation to the webpage was canceled

When I right click and view the properties of the page the url says:

res://ieframe.dll/navcancl.htm#http://www.google.com/

But I have not canceled the page.

Then when I right click and refresh I get the error page:
This program cannot display the webpage

The url of this page is
res://ieframe.dll/dnserrordiagoff_webOC.htm#http://www.google.com/

Of course I am connected to the internet and my browser works fine.

I am running VS2005 on XP Pro. I do notice that my dynamic help
doesn't work anymore. Even when I have it set to "check online first,
then local" it doesn't check online. Could the Visual Studio IDE have
somehow lost its connection to the browser.

I am new to C# so could be missing something very obvious.

Thanks in advance.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

It seems to be a problem with the DNS (from the error link).

Other than that I seeno error, it's pretty straighforward really.
 
S

sonicwrx

Hi,

It seems to be a problem with the DNS (from the error link).

Other than that I seeno error, it's pretty straighforward really.

I don't think it is a DNS issue as I get the exact same error when I
use google's ip address:

wbScrape.Navigate(new Uri(@"http://64.233.161.99"));

Also when I run

nslookup www.google.com

I get a perfectly valid response. Basically I have no problems
connecting to the internet on this computer.

Interestingly, when I run

wbScrape.Navigate(new Uri(@"http://localhost"));

the control works.

I am beginning to think it is a security or zone related issue. On the
web control help page

http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser(VS.80).aspx

it does say this:

The WebBrowser control cannot be used by partially trusted code. For
more information, see Using Libraries from Partially Trusted Code.

Could it be that my code is only partially trusted? How do I check
that?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top