How can I set the attribute RequireLogin for an FBML ASP.NET MVC canvas application ?

Nov 24, 2009 at 5:42 AM

My application is an FBML canvas application, built using the Facebook Developer Toolkit for ASP.NET MVC framework, it's hosted on a fan page of Facebook so I don't use the Facebook Connect Login.

To make sure user must login into Facebook before using my application, I know If we use ASP.NET WebForms, we can simply inherite from the CanvasIFrameMasterPage and  set the attribute RequireLogin  in the constructor IFrameMaster like below:

    public partial class IFrameMaster : Facebook.Web.CanvasIFrameMasterPage
        public IFrameMaster()
            RequireLogin = true;

But I have to use the ASP.NET MVC framework. So is there anyone please tell me how I can set the attribute RequireLogin ?

Thanks in advanced.

Nov 24, 2009 at 9:39 AM

using Facebook.Web.Mvc;

public class HomeController : Controller {

  private const string REQUIRED_PERMISSIONS = "status_update,........";

  [FacebookAuthorization(IsFbml = true, RequiredPermissions = REQUIRED_PERMISSIONS)]

  public ActionResult Index()


     var api = this.GetApi();

      return View();



Nov 24, 2009 at 10:38 PM

That's great. It worked. Thank you very very very much.

But is there anyway to make sure users have to login before using my application but don't request accept any required permissions ?

Thanks again

Nov 25, 2009 at 3:34 AM


RequiredPermissions is optional.

Are you Vietnamese? My YM: