Really basic help

Jun 27, 2007 at 2:07 AM
Hi there

I know these are dumb questions - but I need help filling in some gaps with my understanding of how these applications work. Ive got a simple ASP.NET 2.0 application running which lists records from a database, and eventually these records will be listed based on the facebook user id of the user. I can get my friends photos listing etc but it doesn't clear anything up for me.

1. I don't understand the difference between "a logged in user viewing/editing the application on their own pages/profile" and a user viewing someone else's profile in terms of how my application sees these users. I assume the user in the session is the logged in user - If i use this to retrieve the user id, doesn't that mean everyone sees their own records in my database (and not the records for the profile they are viewing)?

2. I cannot figure out how to get my application on my profile page, nor how to format the pages so the content does not span 100% of the page.

3. I cannot find any C++ samples or examples that help me to understand how the applications tie together at a really basic level (eg the difference between clicking on my application in the left nav as opposed to having it in a nice box on the profile page.

If someone could please forward me to any documentation that covers these basics I would really appreciate it. I feel there are a lot of assumptions made in the documentation as to the developers basic understanding of the applications. Then again, I do have a head cold tho - so perhaps it is just me being a bit brain dead :)

Thanks heaps in advance for your time
Mariellen




Coordinator
Jun 27, 2007 at 10:49 PM
I am not sure I can help much. I don't have any C++ samples, and am not very experienced in C++.

As for the other questions.

Your app does not really run on the profile page. You can put some fbml on a user's profile with some info about your app and links to pages within your app. But, essentially this is static fbml that you set for the user to have a presence on their profile page.

But, your app actually is used and interacted with on a canvas page. The canvas can either be fbml (which is emitted from a url you host and incorporated directly into the html emitted by facebook) or an iframe hosting any webpage that you write.

You can have several canvas pages interacting to comprise your app. But, you need to establish a session on behalf of the user within your canvas page and then interact. So, a user can never go to someone else's version of your app. Because they could see someone else profile FBML about your app, but as soon as the click a link to take them to your canvas page (under apps.facebook.com). You will provide them with their (the logged in user) version of your app.

HTH
Jun 28, 2007 at 4:50 AM
Hey there

I am writing it in C# sorry for the typo above. I found some examples but none really explained what you just did.
Thanks for your response. I think I understand a bit more.. a few more questions if you have time?

1. The "static" FBML on the users profile page - can this be generated for that specific person and then written to their profile (so the content is different on each users profile) ? Is this what the setFMBL method is for? I have not been able to get this to work currently (I have just found a toolkit with the method but I have hit an error that i am yet to investigate).

2. I believe I have canvas pages running already - eg Default.aspx which is the landing page from the left nav, Help.aspx, TermsAndConditions.aspx and Update.aspx which should be the "edit" page for the app and also the page the user is directed to after installing the app. (The initial redirect works fine but sometimes my response.redirects dont work - im looking into this). These are canvas pages ?

3. What version of the toolkit is the latest? I installed 1.1 and then I found an example which has all the objects broken out and listed under an "entities" folder - Should i be using this one instead ?

4. Im still unsure why the content in my pages eg the Default.aspx (I am using FBML not iFrame) spans all the way across even if I put it in a div that only spans 80%.

If you could point me to an example which shows how to set the users profile FBML (and has the toolkit that I should be using) I would really appreciate it.

Thanks again for clearing up some of that simple stuff for me.
Mariellen
Jun 28, 2007 at 6:22 AM
Hey
I just got your latest code and the canvas page etc has really helped, I have now got something on my profile page.
As for my previous questions
Q1 - The content i would like on the persons profile is kind of like a feed of their journal entries - Will I need to make a push mechanism from the journal post page to update that user's profile FBML when they make a new post? I guess i am trying to make something like Flog but a lot simpler for the user and I was hoping it would update whenever someone looked at their profile (I didn't realise the profile page box was static). Do you know what i mean ?
Q2 - Your base canvas pages seem to have fixed the problems I was having.
Q3 - i think I now have your latest code and it has helped.
Q4 - Still unsure about the "prettiness" of my content on the page. If i figure it out I will update you, otherwise any tips would be helpful. It looks horrid spanning the whole page.
thanks again
Mariellen
Coordinator
Jun 29, 2007 at 4:08 AM
Can you send me a screenshot of the "ugly" page? I am not following the issue. rpowers@claritycon.com. Thanks.

Q1. Yes, you would have to write code to always call SetFBML from your canvas page to have the user's profile to up to date with the events of you app.

If you have any problems/suggestions with the canvas base pages. I am very open to suggestions.

Jul 2, 2007 at 5:35 PM
Hi All,
I am developing my facebook app using asp.net, vb.net.
I am new to facebook platform and I need your suggestions in developing my facebook app.
I am unable to connect to facebook because of the following error

The remote name could not be resolved: 'api.facebook.com'

I am working on the localhost inorder to debug the application.
I have followed the example "AspNetPlatformSample" in developing my facebook app.

Please reply ASAP.


Coordinator
Jul 2, 2007 at 7:40 PM
What do you get when you type this into the browser address bar?

http://api.facebook.com/bestserver.php

Jul 3, 2007 at 9:36 AM
I am getting the following script when I visited the link : http://api.facebook.com/bestserver.php

<?xml version="1.0" encoding="UTF-8" ?>
- <result method="" type="struct">
- <fb_error type="struct">
<code>101</code>
<msg>Invalid API key</msg>
<your_request />
</fb_error>
</result>




Coordinator
Jul 3, 2007 at 2:53 PM
Not sure then.

It seems like from your app that it can't successfully hit api.facebook.com. But, you just confirmed that you can hit it from a browser. Is your app running on the same machine as the browser you used?
Jul 3, 2007 at 3:31 PM
First thing I should inform you that I am developing my facebook application in my office.
Sometimes I am getting the following error:
Unauthorized source IP address (ip was: 10.8.254.250) or the following one.
The remote name could not be resolved: 'api.facebook.com'
I've been working on this error for a long time but I am unable to locate the possible cause.
I have disabled the ISA firewall.
Still the problem persists.
Also, I have set the anonymous access to my local website address.
Any help?
Please reply ASAP
Coordinator
Jul 3, 2007 at 4:46 PM
I really am not sure how to help. It seems to be some type of network issue on the machine where you host the web application.

Do you use a proxy?
Jul 3, 2007 at 4:52 PM
Hey
I didn't set the proxy , I don't know how to do it.
Any help?



Coordinator
Jul 3, 2007 at 5:21 PM
I am not saying you need one or should have one. I am just guessing at what could be causing the problems you are seeing. If you machine uses a proxy for internet access, that could be a problem.
Jul 3, 2007 at 5:54 PM
This is the error which I am concerned about:

Unauthorized source IP address (ip was: 10.8.254.250)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Facebook.Exceptions.FacebookException: Unauthorized source IP address (ip was: 10.8.254.250)

Source Error:


Line 1540: Throw New FacebookInvalidFqlSyntaxException(XmlHelper.GetNodeText(errors(0), "error_msg"))
Line 1541: Case Else
Line 1542: Throw New FacebookException(XmlHelper.GetNodeText(errors(0), "error_msg"))
Line 1543: End Select
Line 1544: End If


Source File: D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb Line: 1542

Stack Trace:


FacebookException: Unauthorized source IP address (ip was: 10.8.254.250)
Facebook.API.FacebookAPI.ErrorCheck(XmlDocument doc) in D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb:1542
Facebook.API.FacebookAPI.LoadXMLDocument(String rawXML) in D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb:1425
Facebook.API.FacebookAPI.ExecuteApiCall(IDictionary`2 parameterDictionary, Boolean useSession) in D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb:1403
Facebook.API.FacebookAPI.CreateSession() in D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb:1283
Facebook.API.FacebookAPI.CreateSession(String authToken) in D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb:128
Facebook.Components.FacebookService.CreateSession(String authToken) in D:\CricketReporter\Components\Facebook\Components\FacebookService.vb:196
Facebook.WebControls.CanvasIFrameBasePage.Page_Load(Object sender, EventArgs e) in D:\CricketReporter\Components\Facebook.WebControls\CanvasIFrameBasePage.vb:76
Default.PageLoad(Object sender, EventArgs e) in D:\CricketReporter\newlyadded\Default.aspx.vb:23
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Coordinator
Jul 3, 2007 at 6:31 PM
Do you have anything specified in the IP Addresses of Servers Making Requests setting for your developer account?
Jul 4, 2007 at 7:31 AM
Hi Ryan
One last question - how do I allow other developers to work on my application and add it to there profile etc? I have set it so that only developers of the application can add it to their profile however Im not sure how to share it with other developers.
Thanks again for all your help so far
Mariellen
Jul 4, 2007 at 7:39 AM
Yes I do .
This is the address I have given:
Callback URL : http://localhost/CricketReporter/newlyadded/
Canvas page URL : http://apps.facebook.com/newlyadded
Use: Iframe
Application type: Website
*IP Addresses of Servers Making Requests :http://localhost/CricketReporter/
Can your app be added on facebook : yes
Post added URL : http://localhost/cricketreporter/newlyadded/
App Description: xxxxxxxx

I have left rest of the fields as blank.
Any help?
Jul 4, 2007 at 7:43 AM
After leaving the IP Addresses of Servers Making Requests filed as blank , I am receiving the following error

Friends: XML returned by Facebook is empty!
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Facebook.Exceptions.FacebookException: Friends: XML returned by Facebook is empty!

Source Error:

Line 329: If Not nodeList Is Nothing AndAlso nodeList.Count > 0 Then
Line 330: If (Not nodeList(0).HasChildNodes) Then
Line 331: Throw New FacebookException("Friends: XML returned by Facebook is empty!")
Line 332: Else
Line 333: Dim results As XmlNodeList = xmlDocument.GetElementsByTagName("friend_info")


Source File: D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb Line: 331

Stack Trace:

FacebookException: Friends: XML returned by Facebook is empty!
Facebook.API.FacebookAPI.GetFriends() in D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb:331
Facebook.Components.FacebookService.GetFriends() in D:\CricketReporter\Components\Facebook\Components\FacebookService.vb:339
Default.PageLoad(Object sender, EventArgs e) in D:\CricketReporter\newlyadded\Default.aspx.vb:38
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Jul 4, 2007 at 12:35 PM
Hi Ryan
I am able to add my facebook app.

The error was specifying the IP Addresses of Servers Making Requests field.
My requirement is as follows:

1.I want to place some links in the profile box depending on the category selected.

2.I am designing a form with three select controls and want to set it as a canvas page.
Iam using the same form tag as :
<form id="form1" action="Default2.aspx">

3.But how to retrieve the selected values from the select controls as I am unable to receive the values using Request.form() method.

4.Also, I want to know how to set the infinite session for a user.

5. How to redirect a user to his profile page in the facebook upon click on a anchor link or HTML button control in a canvas page.

Thanks for all your help so far
varaprasad.


Coordinator
Jul 5, 2007 at 2:40 PM
3. I assume you are using FBML. Are you asking in FBML how do you read what the user did on your form after they submit?
4. If you know the userid and sessionkey associated with your user's infinite session with your app, you can specify both (along with the api and secret that you are already specifying). This will avoid the app login logic, and get your user directly into your app.
5. Just use: "http://www.facebook.com/profile.php?id=" + base.FBService.UserId as the url

Jul 6, 2007 at 11:19 AM
Hi Ryan,

I have developed my first facebook app with ur support.
I need to add complex functionality according to my requirment.
Below are the few questions for which I am concerned about:
I am using Iframe for displaying the contents.

1. I need a sample for Ajax mock functionality. I am very confused because of lack of support for javascript in the facebook.( I am developing my facebook app with Asp.net + VB.net)

2. How do I enable a new user to add my app without login into facebook. ( I need a code sample for reference probably 2 or 3 lines)

3. Why the Images are not getting displayed with the following url adrress in the profile box.
http://localhost/CricketReporter/Images/headerbg.gif

please reply ASAP .





Jul 6, 2007 at 1:57 PM
My requirement is showing the latest articles in the profile box.
4. I want to know whether it is possible to dynamically update the content in the profile box. i.e., after every 30 min

Jul 6, 2007 at 3:03 PM
I want to know the code required for Share button.
Is there any FBML tag for this?
If yes, please reply ASAP.
Coordinator
Jul 6, 2007 at 3:49 PM
I am not sure I follow all of your questions. But, I will give it my best shot.

1) I don't have a sample right now. The documentation on it is here http://developers.facebook.com/documentation.php?doc=fbml (search for Mock AJAX). Possible someone else has a sample

2) You can't. You need to have a valid active facebook session. Otherwise, how could you know who was adding your app.

3) Urls need to be a publically available web address. You can cheat during development and have your iframe point to localhost addresses (because on your machine you can render those pages). But, in your profile, the facebook webserver is rendering the images for you. So, they would not see your local host addresses.

4) You could write some type of service that runs periodically and updates the profile on behalf of your users. I think others have implemented similar approaches.

5) fb:share-button
See doc here, http://developers.facebook.com/documentation.php?doc=fbml
Jul 6, 2007 at 4:08 PM
Hi Bryan,
Thanks for your quick reply.

can I add the FBML tags using setFBML() function.(i.e., vb.net code)
If not, what is the exact way.

Thanks for your help so far.



Jul 6, 2007 at 4:25 PM
I am receiving this error when ever I remove the app from my account and re-add the app again.

Session key invalid or no longer valid
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Facebook.Exceptions.FacebookTimeoutException: Session key invalid or no longer valid

Source Error:

Line 1610: Throw New FacebookRequestLimitException(XmlHelper.GetNodeText(errors(0), "error_msg"))
Line 1611: Case 102
Line 1612: Throw New FacebookTimeoutException(XmlHelper.GetNodeText(errors(0), "error_msg"))
Line 1613: Case 104
Line 1614: Throw New FacebookSigningException(XmlHelper.GetNodeText(errors(0), "error_msg"))


Source File: D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb Line: 1612

Stack Trace:

FacebookTimeoutException: Session key invalid or no longer valid
Facebook.API.FacebookAPI.ErrorCheck(XmlDocument doc) in D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb:1612
Facebook.API.FacebookAPI.LoadXMLDocument(String rawXML) in D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb:1507
Facebook.API.FacebookAPI.IsAppAdded() in D:\CricketReporter\Components\Facebook\API\FacebookAPI.vb:520
Facebook.Components.FacebookService.IsAppAdded() in D:\CricketReporter\Components\Facebook\Components\FacebookService.vb:1153
Facebook.WebControls.CanvasIFrameBasePage.Page_Load(Object sender, EventArgs e) in D:\CricketReporter\Components\Facebook.WebControls\CanvasIFrameBasePage.vb:115
Default.PageLoad(Object sender, EventArgs e) in D:\CricketReporter\newlyadded\Default.aspx.vb:22
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

What might be the cause?
Coordinator
Jul 6, 2007 at 4:27 PM
Not sure about your session error. i will have to try it out.

As for the fbml tag. You can only use that if you are using an fbml type of canvas page. It appears you are using an iframe. So, you would have to implement that functionality yourself.
Coordinator
Jul 6, 2007 at 4:32 PM
Actually, on your last error. The issue is that the facebook session you have stored in the HTTPSession is no longer valid.

You need to catch that error, clear the session and retry.

This is similar to what you need to do to monitor for sessions that have timed out.
Aug 20, 2007 at 9:51 PM
Hi Bryan,

I am using dotnet 2003 version for developing the facebook app.
I need the .dll files compatible with Dotnet version 2003.
Where can I get help from the codeplex website?


Thanks in advance
Prasad.


Coordinator
Sep 12, 2007 at 4:48 AM
Hmmm. This might be tough. The toolkit is pretty dependent on .net 2.0. Unless there is a lot of demand for 1.1 framework, I don't think it will be a top priority.