prabirshrestha / FacebookSharp

Facebook Graph API for .Net
Other
30 stars 15 forks source link

Iframe app, IE Session state problem and a Fix #6

Closed jamesto closed 14 years ago

jamesto commented 14 years ago

I would like to share my solution with other Facebooksharp users... Maybe it is possible to include this fix in Facebooksharp core also?

The problem is that in IE, if a parent frame has a different domain than the child page, the session data (stored in the Session object) is not preserved as a security precaution.

If you have this problem, the answer is to add the following code to your ASP.NET code-behind.

protected override void OnPreRender(EventArgs e) { Response.AppendHeader("P3P", "CP=\"CAO PSA OUR\""); base.OnPreRender(e); } This will add the right headers to every page.

prabirshrestha commented 14 years ago

thanks,

i even made a long comment in the canvas iframe sample about P3P header. (hope users will read it when implementing canvas iframe application) http://github.com/prabirshrestha/FacebookSharp/blob/master/src/Samples/FacebookSharp.Samples.CanvasIFrameApplication/Controllers/HomeController.cs

and incase you are using asp.net mvc, i even created a P3PHttpHeaderAttribute action filter. http://github.com/prabirshrestha/FacebookSharp/blob/master/src/FacebookSharp.Web.Mvc/ActionFilters/P3PHeaderAttribute.cs

i cannot put it in the core library, because once i have a dependency in Response or anyting realted to web i need to reference System.Web.,dll which will not allow me to compile under client profile. for those reasons i had to make different libraries such as FacebookSharp.Web.Mvc, it would be great to put in FacebookSharp.Web (at the moment FacebookSharp.Web doesn't exist).