Facebook多帐户 [英] Facebook multi account

查看:81
本文介绍了Facebook多帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个简单的win-forms工具来管理不同的社交帐户.
如果用户有多个Facebook帐户,我会遇到问题.当我尝试以第二个用户身份登录时,我只是在webBrowser中重定向页面.
我尝试使用InternetSetOption和INTERNET_SUPPRESS_COOKIE_PERSIST标志,但似乎无济于事.如何解决此问题?

登录代码

I want to write a simple win-forms tool for managing different social accounts.
I have a problem if user has several Facebook accounts. When I try to log in as second user I just got redirecting page in webBrowser.
I tried to use InternetSetOption and the INTERNET_SUPPRESS_COOKIE_PERSIST flag but it seems it does not help. How can I resolve this problem?

Login code

var lParameters = new Dictionary<string, object>();
lParameters["client_id"] = AppId;
lParameters["redirect_uri"] = "https://www.facebook.com/connect/login_success.html";
lParameters["response_type"] = "token";
lParameters["display"] = "popup";
lParameters["scope"] = "user_about_me";
Uri lUri = mFacebookClient.GetLoginUrl(lParameters);
Main.webBrowser.Navigate(lUri);

已添加: 也许我在InternetSetOption上做错了什么?对不起,新手问题.我真的应该在此答案中使用它如何使用InternetSetOption?看起来很困难...

ADDED: Maybe I'm doing something wrong with InternetSetOption? Sorry for newbie question. I really should use it like in this answer How do I use InternetSetOption? It looks difficult...

推荐答案

最可能的原因是因为Facebook正在使用会话ID设置cookie. INTERNET_SUPPRESS_COOKIE_PERSIST仅会使cookie保持非持久状态,它们将在浏览器被破坏或浏览器会话结束后被清除,因此,如果您使用的是同一实例,它们仍将保持活动状态.

Most probable cause is because Facebook is setting a cookie with the session ID. INTERNET_SUPPRESS_COOKIE_PERSIST only makes cookies non-persistent, they will be cleared after the browser is destroyed or browser session finished, so if you are using the same instance they will still be alive.

您可以使用InternetSetOption(0,42,NULL,0);完成浏览会话. (摘自此处: http://social.msdn.microsoft.com/Forums/eu/csharpgeneral/thread/76a38eee-3ef6-4993-a54d-3fecc4eb6cff ),因此应将INTERNET_SUPPRESS_COOKIE_PERSIST和INTERNET_OPTION_END_BROWSER_SESSION结合使用(即42表示),并为此做好准备.一个新的登录名.

You can finish your browsing session with InternetSetOption(0, 42, NULL, 0); (taken from here: http://social.msdn.microsoft.com/Forums/eu/csharpgeneral/thread/76a38eee-3ef6-4993-a54d-3fecc4eb6cff), so combining INTERNET_SUPPRESS_COOKIE_PERSIST and INTERNET_OPTION_END_BROWSER_SESSION (is what the 42 means) it should be cleared and ready for a new login.

这篇关于Facebook多帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆