0

I have a facebook app i m working on.

Only at the IndexController I m using CanvasAuthorize to authorize against facebook, and i want to avoid it from every other pages, due to redirects.

Here is what happens: I have IndexController and it has an Index action which I decorate with [CanvasAuthorize] . Then store the facebook user along with token in the session. So in the other pages i wont need Canvas authorize.

When I m debugging with Visual Studio, if i access a page other then Index, it doesnt redirect me to the facebook app. But it show localhost:port . how can i enforce that, anyone tries to see any page will be redirected to facebook.com/appname.

Thanks.

DarthVader
  • 52,984
  • 76
  • 209
  • 300

1 Answers1

1

Do you mean you want to redirect your user to the IndexController if they are not logged in on Facebook or they want to use your App?

If I understand it right, your indexController is the one who authenticate your user on Facebook. And the other pages will be accessible after the authentication.

Is your Facebook app an iFrame app? If so then you need a Javascript that will redirect you to the indexController or directly or Apps.Facebook.con/YourApp.

 <script>
 if (top == self)
 {
      top.window.location = '//apps.facebook.com/yourApp';
 }
</script>
Allan Jikamu
  • 341
  • 2
  • 8
  • it s a canvas app. if you know the hostname etc for the app, you can reach it with browser without going through facebook. and if u are already logged in to facebook, it doesnt display the app under facebook page. I want to avoid that. – DarthVader May 04 '12 at 17:27
  • 1
    yes the javascript script above will do job, just put it in every page of your application. – Allan Jikamu May 05 '12 at 02:51