我想实现使用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浏览器
发布评论