Version 3.01 still doesn't work for iFrame apps - DEVELOPERS PLEASE HELP

Feb 1, 2010 at 7:55 PM

I have just tried newly release 3.01 version, but however after couple of months of waiting

my application still throw exception "A session key is required for calling this method" when

I try to call: Api.Users.GetLoggedInUser(); on second page where I go by pressing a link on

home page.

I also downloaded examples, but there are no iFrame example with 2 pages. I belive that this

problem is still the main obstacle for using FDT 3.0 for lot of developers.

I anybody know for solution, please HELP !!

Feb 2, 2010 at 12:06 AM

Shit, this is a huge problem seeing as the app I a developing is in the FDT 3.0 and has muliple pages. Do you know if any of the older version work? I am trying to release my app next month and can't be waiting for a fix to come at some unknown point. If iframes was not working why was 3.0 even released? I would consider this a MAJOR bug that should have never made it past an alpha test let alone a beta.

Feb 2, 2010 at 6:37 AM
Edited Feb 2, 2010 at 6:38 AM

I'm confused.  I've developed a couple apps now with this toolkit and I don't have this problem.  I've done multiple pages and I've also done it using master-pages.  I've been using the Nov. Release of the FDT 3.0 and I have only had a few minor problems.  Make your your pages are inheriting from the respective Facebook.Web.FacebookCanvasPage.  Inherit of FramebookCavaseBasePage if your not using master pages.  Make sure to have RequireLogin = true before any other Facebook API code is run.  You need to put a try{} catch{} around your code and display your error.  Nobody can help if you don't semi diagnose the problem.

And Again : Make sure ALL YOUR PAGES ARE inheriting off the respective Facebook.Web.*CanvasPage that need to use the facebook API.

Now if your talking about embedding your own iFrame within the Facebook IFrame, there are ways to get that working to, keeping all the session data in tact.

good luck

stringa

Feb 2, 2010 at 6:08 PM

Hello Stringa,

thank you very much for such detail info. I have made all of this, but still doesn't work. I used CanvasIFrameBasePage (no master page).

If I set RequireLogin on second page I get redirect on home page. If RequireLogin is set just home page call of method:

long id = Api.Users.GetLoggedInUser();

results in previous mentioned exception.

here is my code, when I press on link (red color) the app is switching on page2 and raise exception.

Do you see anything I have made wrong?

 

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FBToolkit.Samples.IFrame.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">

<head id="Head1" runat="server">
    <title>title</title>
</head>
<body>
    <script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
    <form id="form1" runat="server">
    <div>
        this is page1. <a href="Page2.aspx">Click for Page2</a>.
    </div>
    </form>
     <script type="text/javascript">
        FB_RequireFeatures(["XFBML"], function() {
            FB.Facebook.init("b4a57d1a315d7cd1e6cc9bfdb0618e7e", "channel/xd_receiver.htm");
        });
    </script>
</body>
</html>

 

Default.aspx.cs:

using ....
namespace FBToolkit.Samples.IFrame
{
    public partial class Default : Facebook.Web.CanvasIFrameBasePage
    {
        public Default()
        {
            RequireLogin = true;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            long id = Api.Users.GetLoggedInUser();
        }
    }
}

 

Page2.aspx:


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Page2.aspx.cs" Inherits="FBToolkit.Samples.IFrame.Page2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">

<head id="Head1" runat="server">
    <title>title</title>
</head>
<body>
    <script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
     <script type="text/javascript">
        FB_RequireFeatures(["XFBML"], function() {
            FB.Facebook.init("b4a57d1a315d7cd1e6cc9bfdb0618e7e", "channel/xd_receiver.htm");
        });
    </script>
</body>
</html>

 

Page2.aspx.cs:

using ....
namespace FBToolkit.Samples.IFrame
{
    public partial class Page2 : Facebook.Web.CanvasIFrameBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            long id = Api.Users.GetLoggedInUser();
        }
    }
}

 

 

 

Feb 3, 2010 at 8:37 PM
Edited Feb 3, 2010 at 8:38 PM

Can anybody help me with this, PLEASE?

Feb 4, 2010 at 12:07 AM

Your problem might be that you are not passing all of the canvas URL parameters from Page 1 to Page 2.  In particular, the "fb_sig_session_key" parameter must be accessible to all of your pages, otherwise any FB API function that requires a session will fail.  So try changing the link on Page 1 to this:

 

<a href="Page2.aspx?<%=Request.QueryString%>">Page2</a>.

 

Feb 4, 2010 at 7:36 PM

YES, it was the case. Thank you very much !!

 

Feb 6, 2010 at 5:14 AM

I have a very simple test project folling the code above and as soon as

long id = Api.Users.GetLoggedInUser();

is called I get

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 69.63.180.21:80

If I comment out that line of code, I get up a blank page with my test label on it. I'm hosting this page at 1and1.com, it almost sounds like a connection to Facebook is blocked somehow? I think I have configured the Facebook App correctly and I have followed the directions in this thread...

Feb 7, 2010 at 4:06 AM

Problem solved, there was indeed issues going from 1and1.com to facebook. A proxy setting in web.config solved it:

 

<defaultProxy>
<proxy
usesystemdefault = "false"
bypassonlocal="false"
proxyaddress="ntproxyus.lxa.perfora.net:3128"
/>
</defaultProxy>
</system.net>

<system.net>

<defaultProxy>

<proxy

usesystemdefault = "false"

bypassonlocal="false"

proxyaddress="http://ntproxyus.lxa.perfora.net:3128"

/>

</defaultProxy>

</system.net>