0

In my mvc3 facebook application i detect user if login status = connected or let him to login by Facebook login popup.After login i save user Facebook id in session:

HttpContext.Current.Session["CurrentUserFacebookId"] = FacebookId;

The problem is in safari browser. The default settings of safari is to "block cookies from third parties and advertisers". So session is not saved and user can't use my application, because all actions check the session.How to solve this problem?Thanks

4

2 回答 2

1

您可以尝试通过使用简单的P3P 策略设置标头来执行此操作

P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"

或者在 PHP 中:

header('P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');

或者在 ASP.NET 中:

HttpContext.Current.Response.AddHeader("p3p", "CP=\""IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""")

但我认为在 Safari 5.5.1 左右之后这个技巧不再起作用了。我认为 Safari 5.5.1 或更高版本中的唯一方法是通过将“首选项”->“隐私”中的“阻止 cookie”设置为“从不”来启用 3rd 方 cookie/会话。

于 2012-08-20T07:49:57.343 回答
0

也许这个答案已经晚了。

但是,尝试在 web.config 中输入: "forms loginUrl="~/Account/Login" timeout="2880" cookieless="UseCookies" "

在身份验证标签内。那(粗体部分)启用cookie并为我工作。

也许这不是最好的解决方案,但它适用于 safari。并避免用户与偏好交互。

于 2013-09-09T18:42:46.417 回答