0

I have a Facebook Application as an Area inside my Web Site. It has been developed using the Microsoft.Mvc.Facebook namespace and following the Facebook Template shipped with Visual Studio 2012.

Everything worked fine until i upgraded my project to ASP.NET MVC 5. Now, whenever i open the app from Facebook, i got a white screen. No exception. No application_error. anything. I can even debug the code step by step down to the view and the layout, it looks everything fine, but...it doesn't render anything.

Some info could help. This is my AreaRegistration:

public class FacebookAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Facebook";
            }
        }


        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                name: "Facebook_default",
                url: "Facebook/{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new[] { "MvcPoli.Areas.Facebook.Controllers" }
            );


            DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("Facebook")
            {
                // Register a DisplayMode of "Facebook" for views that are rendered from this area
                ContextCondition = c => c.Request.Url.Segments.Length >= 2 && c.Request.Url.Segments[1].TrimEnd('/').Equals("facebook", StringComparison.OrdinalIgnoreCase)
            });
        }
    }

All the controllers have been created inside the area by simply inheriting from the relative controller in the main site. For Example:

public class ActionController : MvcPoli.Controllers.ActionController
    {


    }

The only exception is the HomeController that has different signatures due to facebook routines (i removed the business code here):

public class HomeController : MvcPoli.Controllers.PoliBaseController
    {
        //
        // GET: /Facebook/Home/

        [FacebookAuthorize("email", "user_hometown", "user_location")]
        public async Task<ActionResult> Index(FacebookContext context)
        {
         }

public ActionResult Permissions(FacebookRedirectContext context)
        {
            if (ModelState.IsValid)
            {
                return View(context);
            }

            return View("Error");
        }
      }

But, as said, everything worked fine before upgrade. Can you help me please?!?

marfin
  • 103
  • 1
  • 9

1 Answers1

1

After one month of struggling, we found the solution! ASP.NET MVC 5 automatically added the X-Frame-Options attribute denying framing:

After update to MVC 5, iframe no longer works

Hope this can help someone else!

Community
  • 1
  • 1
marfin
  • 103
  • 1
  • 9