|Number of votes:||1|
And even with third party cookies enabled in Safari it behaved badly. Since I have only one Mac to test with I don’t know if the issue is specific to Safari on OS X, a verison of Safari or just this particular client. Googling the problems generate a number of hits but not the amount you would expect if this was a “global” Safari issue. But I still had the need to work around the issue.
Starting from the user control I created in the previous article, I added some logic to set the Facebook session from the ASP.NET session, and to post a newly signed-in session’s data to my application. The first time the sessionChange event is raised I don’t do anything special, letting the standard cookie approach do it’s work. However, instead of simply refreshing the page I add a querystring parameter with a refresh counter. So when the page loads again I know that it has been loaded before.
Here’s the updated client script. Note the Session[“FacebookSession”] calls which reads data saved in the next step:
On the server I want to get the posted value containing the Facebook session, deserialize and use it, and store a serialized version in the ASP.NET session state for use in the client script above. For JSON serializing in .NET I decided to go with the standard serialization classes in the System.Runtime.Serialization.Json namespace which sits in the System.Runtime.Serialization assembly, so you’ll need a reference to that. Further, a class is needed which corresponds to the JSON object:
Finally, don’t forget to add or change the module reference in web.config if you use this code unedited – the class in this example and in the previous one have different names.
The code above is also available in the code section. This time, too, I have edited the code to fit it more easily into the article, so be warned that it might not build or work without a little edit :)