WebBrowser control: Navigation to the webpage was canceled

好久不见. 提交于 2019-12-08 20:28:54

问题


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?


回答1:


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.




回答2:


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/



来源:https://stackoverflow.com/questions/16422725/webbrowser-control-navigation-to-the-webpage-was-canceled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!