Signed_request lost in ASP.NET session, confusing my website

Posted by Csabi on Stack Overflow See other posts from Stack Overflow or by Csabi
Published on 2012-04-13T11:24:33Z Indexed on 2012/04/13 11:29 UTC
Read the original article Hit count: 183

Filed under:
|
|
|

I have an ASP.NET MVC 3 website which is available both from a specific public url, and I'm also making be available as a Facebook App.

Inside my website logic, in some places I have to determine whether the current request is from the Facebook-app, or from the public website, because I want to display content based on this environment.

So, for eg. if the user is using my site as a facebook-app, then I want to display a picture, and if the user is using my site normally, then I don't wanna display a picture.

To determine whether I'm from a Facebook app, I check the "signed_request" in the HttpContext.Request, and store it in the HttpSession to be available for my other actions, not just for that action (url) which is defined for my Facebook app.

So when a child-action is executed, I can determine based on the Session, that the website is used as a FB-app or not.

The problem happens, when the Session times out, because then althought the logic is still running inside Facebook, my logic thinks it's not inside Facebook.

Any advice?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET