WPF web浏览器

编程入门 行业动态 更新时间:2024-10-24 18:18:07
本文介绍了WPF web浏览器 - 检测重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想实现使用WPF一个简单的Facebook登录流程。事实证明,我需要的,如果应用程序是一个桌面应用程序使用某种嵌入式浏览器的应用程序中。因此我使用WebBrowser控件,但我似乎不能正确地检测重定向URL。

I am trying to implement a simple Facebook login flow using WPF. It turns out that I need to use some sort of embedded browser within the application if the application is a desktop application. Therefore I am using WebBrowser control, but I can't seem to correctly detect the redirecting URL.

在我加载Facebook登录网页和登录之后,浏览器重定向到表单的页面

Once I load the web page for facebook login, and after login, the browser redirects to a page of the form

的 www.facebook/connect/login_success.html#access_token= ....

但是,如果我看URI源,那只能说明到login_success.html并切断无论是#符号后。我需要这些信息进行进一步的处理,所以我想知道如果任何人都可以在检索使用WebBrowser控件在WPF的访问令牌(或任何其他方式)的建议。谢谢!

But if I look at the URI source, it only shows up to login_success.html and is cutting off whatever is after the # sign. I need this information for further processing, so I was wondering if anyone could advise on retrieving that access token using WebBrowser (or any other way) in WPF. Thanks!

推荐答案

我是有今天的SDK中的WPF样品的保存问题。我想这是与WPF Web浏览器控件的一个问题(如你已经infered)。所以我用了windows.forms.webbrowser而不是WPF夏精。这是一个简单的修补程序。

I was having the saving problem with the WPF Sample in the SDK today. I figured it was a problem with the WPF Webbrowser control (like you had infered). So I used the windows.forms.webbrowser instead of the WPF webcontrol. It is a simple fix.

System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); _webBrowser = new System.Windows.Forms.WebBrowser(); host.Child = _webBrowser; this.grid1.Children.Add(host); _webBrowser.Navigated += new WebBrowserNavigatedEventHandler(webBrowser_Navigated); _webBrowser.Navigate(_navigateUrl.AbsoluteUri);

更多推荐

WPF web浏览器

本文发布于:2023-10-31 19:09:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547008.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   WPF   web

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!