If you are interested in what the "Race Condition" is, then there is a flaw in the system, whereas it is highly dependent on time. See the wiki here for more information.
Therefore, the condition I am connected with Facebook Connect and the implementation of single sign-on service with the ASP.NET 4.0 web application (forms-based authentication - IIS7).
The process itself (including Logout) works well, but .....
Here's a scenario where it doesn't quite work 100%:
- The user is registered on Facebook.
- The user goes to my site.
- The user is not logged in automatically (should be, though).
- The user refreshes the page and automatically registers.
When I break the code in step 3 - Facebook cookies do not yet exist (in HttpContext.Current.Request.Cookies).
But when the page reloads (step 4) - there are Facebook Cookies there.
For me, this can be a few things:
Iβm not sure that only in the case of Facebook, access to my cookie access application (delay in cross-domain handshakes - xd_receiver.htm) or a problem with cross-domain cookies themselves and the ASP.NET page life cycle has not yet been granted access.
Has anyone else dealt with this problem?
This is not all-all-and-all-all, but it is annoying (and not very different from the user's perspective).
EDIT:
- . Facebook ( Facebook) , 20 , , STILL . , , . , , - 2 , ?
- Facebook cookie ( Facebook), cookie.
( , )
protected void Page_PreRender(object sender, EventArgs eventArgs)
{
if (FacebookUser.IsAuthenticated)
{
}
}
, - HttpContext.Request.Cookies .
.
, , FB.Init . , cookie. , ( Facebook), ( cookie) .
, , ( cookie, ββ ).
2:
(run on window.load):
FB.init('myapikey', 'xd_receiver.htm', null);
- :
FB.init('myapikey', 'xd_receiver.htm', null);
FB.getLoginStatus(function(response) {
if (!response.session) {
return false;
}
else {
window.location.reload();
}
});
JavaScript - "FB.getLoginStatus" . = (
, JavaScript:
http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US
, :
http://connect.facebook.net/en_US/all.js
doco API JS.
, , doco "" JS API:
http://developers.facebook.com/docs/reference/oldjavascript/
, FB.Connect.get_status() , .
.
"" , - :
window.onload = function() {
FB.init('{0}', 'xd_receiver.htm');
FB.ensureInit(function() {
FB.Connect.ifUserConnected(onUserConnected, onUserNotConnected);
});
};
function onUserConnected() {
alert('connected!');
window.location.reload();
}
function onUserNotConnected() {
alert('not connected');
}
, cookie Forms Authentication, window.location.reload(), . =)