Always redirecting my pages to DEFAULT.ASPX, WHY ?

Sep 24, 2008 at 12:18 AM
Edited Sep 24, 2008 at 12:27 AM
Hi all,

I use the FACEBOOK.NET start kit, and work on an application using several pages. (IFRAME)

I use the Masterpage system but I also have a menu with 5 linked pages

/Default.aspx
/Activity.aspx
etc...

But when i hit the Activity.aspx link on my Default.aspx page, it always go back to the Default.aspx page

I think its a Token problem but i havent found anything to solve my problem (for 3 days now)

Can someone help me to solve this probleme please ?

Thx you very much all !

EDIT : When i hit directly the Activity.aspx page (typing it directly) it works, but when i hit the link on the Default.aspx page it doesn't :(
Sep 24, 2008 at 3:42 AM
Edited Sep 24, 2008 at 3:43 AM
Hi,$0I have this issue too.$0$0The url is ending in /?auth_token=3b0347769f18a46aca8b...$0$0I guess it's directing to the root of the site with the ?auth_token appended???$0$0It's a very annoying problem!$0
Sep 24, 2008 at 4:01 AM
I notice that when I recycle the application pool, it works properly again. And the ?auth_token is no longer in the URL string.
Sep 24, 2008 at 4:05 AM
...After letting the page sit for 5 minutes and coming back to it to chekc on it again, the ?auth_token shows up but things still work as they should...
Sep 24, 2008 at 5:08 PM
Hi,

I worked on finding a solution, but nothing to do for this !

I really dont know how to make this second page work.

So, if someone who have already makes another pages in an Iframe Facebook application can help me, it will be great !

Thx you in advance :)
Sep 26, 2008 at 11:48 PM
Do someone can help me :(
Sep 27, 2008 at 11:48 PM
I still have the problem and haven't solved it... I posted the issue here: http://www.codeplex.com/FacebookToolkit/WorkItem/View.aspx?WorkItemId=11382
Sep 29, 2008 at 1:47 PM
Edited Sep 29, 2008 at 2:34 PM
When the page loads, add the following to the Page_Init0

string authToken = Request.QueryString["auth_token"];

if (!String.IsNullOrEmpty(authToken) && Request.UrlReferrer.ToLower().Contains("[YOUR URL]"))
{
Response.Redirect("[YOUR URL]/" + Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length-1].ToString());
}

The important thing is that YOUR URL is not the apps.facebook.com url but rather your actual canvas url. This works because the first url you goto, redirects be authorized and then is sent to the integration point, which is your default url without a page name, which in your case is default.aspx. If you "auth_token" is not null, you were redirected to the default page by the facebook authorization, and by checking the UrlReferrer you can check to see what the originally requested page was.
Sep 29, 2008 at 6:02 PM
Edited Sep 29, 2008 at 6:10 PM
I added that to facebook.web and then recompiled/uploaded my project and it might have worked. I'll know in a few days depending on whether or not the problem resurfaces

Here's the code I changed in BasePageHelper.cs

 

 

public static void LoadIFramePage(API FaceBookAPI, bool useSession, bool autoAdd, HttpRequest request,

 

 

HttpResponse response, HttpSessionState session)

 

{

 

string authToken = request.QueryString["auth_token"];

 

 

if (!String.IsNullOrEmpty(authToken) && request.UrlReferrer.OriginalString.ToLower().Contains("http://xxxxxxxx/xx/"))

 

{

response.Redirect(

"http://xxxxxxxx/xx/" + request.UrlReferrer.Segments[request.UrlReferrer.Segments.Length - 1].ToString());

 

}

 

if (string.IsNullOrEmpty(FaceBookAPI.ApplicationKey) || string.IsNullOrEmpty(FaceBookAPI.Secret))

 

{

GetKeyAndSecretFromWebConfig(FaceBookAPI);

}

 

new BasePageHelper(FaceBookAPI, useSession, autoAdd, request, response, session).LoadIFramePage();

 

}

 

Sep 29, 2008 at 8:04 PM
Well that wasn't the problem. I looked at some other applications and saw that the hyperlink methods they use don't link to the canvas url, instead they link to the facebook application url. When I modified my pages to link to the facebook application urls my problems went away. This makes more sense because now they can't see the actual address the application is running from so I like the security.