7

Setup

  • Windows 8 (full) tablet
  • .NET 2.0 application

I'm working on a project in which 4 WebBrowser controls are navigating to some webpage simultaneously when the application is loaded. The webpages have the same HTML, but are coming from different web servers.

The problem is that some of those pages display a "Navigation to the webpage was canceled" message in the WebBrowser control. This only happens when the application starts. I have implemented the solution described here to get the status code returned and weirdly enough, it is a 200 = OK status.

When I then refresh the page, it suddenly works correctly. I have suspicions that the problem might be caused by the simultaneous navigations, but I have no idea how I could verify that.

Any ideas?

Community
  • 1
  • 1
Gabriel G. Roy
  • 2,494
  • 1
  • 24
  • 38

2 Answers2

3

Alright, so I ended up firing a navigation and waiting for it to complete before doing the next one and I haven't encountered the problem since. It was a problem that didn't need a fancy solution, and we didn't have time to dig deeper, so we went with that.

Gabriel G. Roy
  • 2,494
  • 1
  • 24
  • 38
  • 2
    I got this problem in the past. After intensive research, it looks like it hit security KB from Microsoft that prevent WebBrowser controller to access the trusted sites zone. – Hao Nguyen Sep 02 '16 at 03:29
  • We've got the same problem using a System.Windows.Forms.WebBrowser in a Word Add-In. We're using the System.Windows.Forms.WebBrowser to preview a temp .mht file and getting a "Navigation to the webpage was canceled" along with this message on a file download prompt: "The file you are downloading cannot be opened by the default program. It is either corrupted or it has an incorrect file type. As a security precaution, it is recommended that you cancel the download" – jazzBox Jun 20 '18 at 15:31
0

A case of Facebook Login using OAuth:

It worked for me navigating from WPF WebBrowser to:

https://graph.facebook.com/oauth/authorize?client_id=zzzzzzzzzzzzzzzz&redirect_uri=https://www.facebook.com/connect/login_success.html&type=user_agent&display=popup

Than something changed and I get: Navigation to the webpage was cancelled

From Chrome I can see the reason:

{
   "error": {
      "message": "Can't load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and sub-domains of your app to the App Domains field in your app settings.",
      "type": "OAuthException",
      "code": 191,
      "fbtrace_id": "GuhAfeO/85U"
   }
}

Why happened?

The link above works only for empty "Valid OAuth Redirect URIs". When a URL was added to support a website login, the app stopped working.

I went to my settings and removed the url. Works now! https://developers.facebook.com/apps/zzzzzzzzzzzzzz/fb-login/settings/

profimedica
  • 2,144
  • 26
  • 37