开发者

WPF WebBrowser - detecting redirects?

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.

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

https://www.facebook.com/connect/login_success.html#access_token=....

But if I look at the URI source, it only shows up to login_suc开发者_运维问答cess.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!


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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜