Facebook.NET

I've been playing with Facebook for a few days and am impressed. This post shares some thoughts as well as introduces a new open source project, Facebook.NET, a framework optimized for developing ASP.NET-based Facebook applications in C# or VB.NET.

In the couple of months since Facebook opened itself up to application developers, it has transformed itself into a platform. There is a mind-boggling momentum at play, not only in terms of user signups, but in the excitement around developing for the platform as well. A lot of web startups are adding a Facebook experience, and at the same time, a number of new applications are popping up (every day... literally!) that are leveraging the power of the social network in creative ways. It will be interesting to see how Facebook holds up over time compared to other networks such as MySpace which seems to be dying in its own noise and chaos.

I've been hooked on Facebook for couple of weeks, and am super-impressed with it. It has spurred me into experimenting with some ideas. Along the way (in classic developer-style), I've put together a small framework, Facebook.NET, for developing Facebook apps using ASP.NET and C#/VB.NET. In the spirit of experimenting, I've also shared it out on CodePlex in its early form. This post contains a very brief intro on using it along with links to key Facebook developer material.

Facebook applications are essentially web sites that naturally embed themselves ala plugins, into the overall Facebook experience, as described in the Anatomy of a Facebook Application. Each application has a presence on the user's main profile page, can add stories to the user's feed, which are then shared out amongst the user's network and can optionally have a set of canvas pages, or a work-areas essentially, where it has a lot more freedom in terms of interactivity and monetization possibilities. Facebook constrains what applications can do, especially on the profile page (for good reasons). It requires them to implement their user interface in FBML - a subset of HTML (devoid of pesky, unsafe tags such as script and object amongst others). Furthermore it manages requests to the application's server for FBML markup and image responses and does the transformation into HTML that is finally rendered in the browser. In return, FBML provides some neat extensions or tags that allow applications to integrate deeply with Facebook's UI concepts and controls. Facebook also provides a nice REST API (including JSON support, which I prefer over XML), and a SQL-based query language called FQL that developers can use to program against their user's profile and network of buddies. Finally, Facebook provides a stage and an Internet-scale "word-of-mouth" style mechanism that enables viral distribution of your application... if it is cool. :-)

Now, more about Facebook.NET and using it, from ASP.NET. Facebook.NET offers managed wrappers over a good chunk of the REST API, and also provides a small (right now) set of server controls that should really simplify writing apps. Before diving further, you should check out the basic Facebook documentation to get oriented a bit, as well as bookmark the Facebook developer's wiki for future reference.

In terms of an application's canvas page, Facebook offers two options: FBML-based apps and IFrame-based apps (there is actually a third variant: an FBML-app containing an IFrame). Facebook.NET supports both styles of applications (in addition to client/desktop apps, but ASP.NET-based Web apps are the focus right now). Facebook.NET provides a wrapper over the REST/JSON APIs so you don't have to worry about marshalling requests/responses. It also provides an ASP.NET server control, <fb:FacebookApplication> that manages the somewhat involved login/session-acquisition process. Finally, it offers an <fb:FqlDataSource> control that allows you to use Facebook queries and bind the resulting data into data-bound controls, ASP.NET-style. Over time, hopefully there will be more it offers, especially in terms of FBML-specific UI controls.

The first thing to do is create an ASP.NET application, add a reference to the FacebookNET.dll and FacebookNET.Web.dll assemblies. If you haven't already done so, add the developer application onto your Facebook profile from where you'll be able to go ahead and register your application so you have an application key and secret to use. The guide to creating an application covers the registration steps - just follow them while ignoring the sample PHP code.

The project also contains a couple of Hello World applications you might use as a starter - what better way to start than to say "Hello World" on a social network, right? If you've already developed an application, you can probably skip this intro, and just start using the bits.

IFrame-based Applications

This is arguably the simpler of the two styles of applications, because you're essentially writing a regular HTML-based Web site that happens to use some Facebook service APIs either in its server-side logic or in its client-side script.

Here are some relevant snippets from the included sample project:

<fb:FacebookApplication runat="server" id="fbApp" Mode="IFrame"
  ApplicationKey="[your_app_key]" Secret="[your_app_secret]" />
<asp:ListBox runat="server" id="friendList" DataSourceID="friendQuery"
  DataTextField="name" DataValueField="uid" />
<fb:FqlDataSource runat="server" id="friendQuery"
  FqlQuery="SELECT name, uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=@UserID)">
  <asp:ControlParameter Name="UserID" ControlID="fbApp" PropertyName="UserID" />
</fb:FqlDataSource>
<script runat="server">
private void OnSendGreetingButtonClick(object sender, EventArgs e) {
    ArrayList ids = ...; // Selected User IDs from friendList
    string fbml = ...;   // Build a greeting to place on the user's profile

    // Use the Facebook profile.setFBML API to update the user's profile
    fbApp.Service.Profile.SetFbml(fbml, null);
}
</script>

The sample application allows picking some users to say hi to, and updates your profile with your latest greeting. It optionally allows you to add a feed story or publish the user's action as it is called in the API.

The key thing to notice here is you can simply drop-in the FacebookApplication server control to start using Facebook APIs in terms of establishing a session, and making REST service calls. You can use the FqlDataSource control like any other ASP.NET data source control to fetch Facebook data to bind into your page's rendering. Another thing to note is you still need to learn FBML. Even if your main user interface is HTML-based and operates within an iframe, you'll want to update the user's profile, or create feed entries, which require FBML. Here is what you end up with:


FBML-based Applications

In contrast with the iframe approach, FBML-based applications use FBML on their canvas pages as well, and can use a variety of user interface elements to match the Facebook look as well as leverage some of their controls such as a user picker (which the sample makes use of).

Here are some of the relevant snippets from the included sample project:

<fb:FacebookApplication runat="server" id="fbApp" Mode="Fbml"
  ApplicationKey="[your_app_key]" Secret="[your_app_secret]" />
<fb:editor action="Default.aspx">
  <fb:editor-custom label="Select some friends">
    <fb:multi-friend-input />
  </fb:editor-custom>
</fb:editor>
<script runat="server">
private void Page_Load() {
    ArrayList ids = ...; // User IDs populated from ids posted by the multi-friend-input element
    string fbml = ...;   // Build a greeting to place on the user's profile

    // Use the Facebook profile.setFBML API to update the user's profile
    fbApp.Service.Profile.SetFbml(fbml, null);
}
</script>

You'll see that the app and server-side code to actually update the profile, publish the story etc. is quite similar. Both do the same thing at the end of the day, but this one gets to use the <fb:editor> and <fb:multi-friend-input> and other related tags to implement the scenario. Here is what you end up with:

I ran into one big gotcha around debugging while developing an FBML application.

An FBML application has to be hosted on the public internet, since Facebook's server's make request to it, as opposed to the browser. In the case of the IFrame approach, the user's browser is the one making requests to your application, so it can be hosted on http://localhost and the debugger can be attached to the local process. I am not able to debug a remotely hosted application. Furthermore, any error information or exception message you send out from your application with an HTTP 500 status code turns into an unfriendly Facebook error saying something like "the makers of the app and Facebook are working out the kinks" - which is completely useless for debugging. So to help get debuggability back to at least printf/alert-style debugging, the FacebookApplication does a couple of things: it has an EnableDebugging property you can set to true when debugging, and in that mode, it catches unhandled exceptions to write out the exception message, stack trace and form post values. You can also turn on tracing in that mode. This lets you start to get to the bottom of errors. I'll be improving this some more over time, so you application can have useful error pages should they occur in release mode.


IFrames vs. FBML

When I first started looking at Facebook applications, I was quite sure FBML was the way to go for implementing the application's Canvas pages. Now I am not so sure.

FBML allows you to use a bunch of interesting Facebook user interface elements, and naturally pick up the Facebook theme. It does come at some cost: your application is constrained in terms of usage of script for example, which limits interactivity, as well as advertising. It also potentially increases latency issues as your server needs to serve up FBML, which has to be converted to HTML on Facebook's servers, before it gets rendered into the browser. To further the problem, Facebook seems to have a low threshold for timeouts, and this latency could result in an unfriendly error message, should processing on either your server or Facebook's servers take more than the allocated time.

The compelling reason for using iframes is that it allows you to do as you please within your frame, which includes the ability to run script, use your familiar Ajax framework, as well as display advertising. The downside of course is you either need to work extra hard to mimic the Facebook theme, or possibly risk a lesser than ideal level of user interface integration.

In closing, check out Facebook.NET, let me know what you think, and stay tuned for a future posts related to this. Hope to get a couple of real apps out there one of these days.

Posted on Wednesday, 7/18/2007 @ 12:14 PM | #Facebook


Comments

139 comments have been posted.

timheuer

Posted on 7/18/2007 @ 2:00 PM
had you seen the toolkit microsoft already partnered with for .NET and facebook? www.codeplex.com/FacebookToolkit

Soven Shrivastav

Posted on 7/18/2007 @ 6:57 PM
I myself have admired so much about facebook and creativity associated with it. Having said that I will definitely try .net version presented by you. I am sure, as always there will be a lot of knowledge and insights along with it.

Ron Myers

Posted on 7/18/2007 @ 8:32 PM
Thanks for the interesting post, the library as well as the gotcha.

Have you attempted to submit any applications to FB? From what I last heard the wait time to get it approved was a very process - this has kept me from developing any applications for Facebook.

Richard LOPES

Posted on 7/18/2007 @ 10:10 PM
Hi,

Looks very good. I went to the Facebook website after reading your ticket. I went there in the past several times but wanted to refresh my memory.

By the way, a common spelling mistake is spreading among bloggers when they rightly use "a la" (but write "ala"). It's actually two words meaning almost "like the". I'm not even talking about the accent on the a here, missing from many keyboards.

My two cents,

R. LOPES

Phil

Posted on 7/19/2007 @ 10:45 AM
Great work, the Microsoft kit was a little lean. I ended up coding my own in C# for a couple of Facebook Applications, DreamBook, which allows users to record dreams which they can tag friends in and it will interpret them with a dream symbols dictionary ( App Id 2437318242 ) and eBay Auctions, which allows Facebook users to display eBay Auctions on their profile, also interfaces with the eBay API ( App Id 2350283130 ). Wait time for approval varies greatly depending on the complexity of the app, anywhere from two hours to two weeks.

Shawn Oster

Posted on 7/19/2007 @ 1:16 PM
Weird, I swear I posted yesterday. Anyway, seems the whole Facebook .NET crazy is growing:

Steve Trefethen posted one a few days earlier as well:

www.stevetrefethen.com/blog/VisualStudioStarterKitForFacebookApplicationDevelopment.aspx

Lots of great kits out there to get started on Facebook and .NET.

Selva

Posted on 7/20/2007 @ 5:43 AM
Hi,
Very useful and new information. Very Nice. Keep blog like this.

Regards,
Selva,
www.selvaonline.com
Keep Visit & Keep Grow.

Vikram

Posted on 7/20/2007 @ 10:15 AM
good new stuff from you. Will look into the development area for fun stuff :)

atul katare

Posted on 7/23/2007 @ 11:25 PM
sir i want your help..
pls tell me...
Is it possible to login My application using FaceBook User ID and Password?

Andy

Posted on 7/30/2007 @ 6:48 AM
in the fbml sample you include all server code in the &lt;script&gt; tags in default.aspx. Is it possible to use code-behind classes? When I try to put the code in a code-behind, I get compilation errors: "Element 'html' occurs too few times", and "Element 'fbml' is not a known element" etc.

Lavanya

Posted on 7/30/2007 @ 2:57 PM
hi Nikhil, just wanted to know... When did you get the skin for your application- hello world?
Is it after submitting your application to facebook directory?
I've created an application and I want see how well it is fitting inside the face Book template and skin , basically Facebook canvac.
But how do I test that?

Nik

Posted on 8/2/2007 @ 4:07 PM
Hi Nikhil,

Thanks so much for providing these wrappers - really useful.

I've got a problem though in that my browser gets into an infinite loop during authentication - going to fb.com/login.php and back to my callback page and then back to login.php continuously, each time getting a new auth code. My api key and secret are correct.

Any ideas?

Thanks again.

Phillip

Posted on 8/2/2007 @ 8:09 PM
I'm having the same kind of problem I think it related to the way the session is created. I needed my app in a hurry so I had to start using microsoft's toolkit. On another note, I have decided to use fbml and iframes This way I get the best of both worlds. On certain pages that need ajax etc. I use <fb:iframe> to display one of my normal pages. Also, you can hide those ugly scroll bars that you get with an iframe in Internet Explorer. Good luck

Nik

Posted on 8/3/2007 @ 3:41 AM
Phillip - The last time I looked at the MS FB toolkit it was very sparse - didnt have half of the useful API calls...are you finding it adequate?

Phillip

Posted on 8/3/2007 @ 7:51 AM
Yea it's has a lot less calls than facebook.net, but it has the basics. I'm also running into a lot of problems using it with FBML. But, right now there aren't many other options.

Phillip

Posted on 8/3/2007 @ 1:37 PM
Actually I made that last comment before getting the latest release. The latest release is very well documented. With a lot of functionality. I downloaded it today, and I have been tinkering with virtually all day. Very good documentation.

Tammie

Posted on 8/7/2007 @ 1:03 PM
Hi Nikhil,

This is great. We also found that the MS toolkit was too lean and buggy and I ended up writing our own wrappers. Check out our app "Phonebook" by Jangl. We went with the FBML with embedded IFrame approach because of the limitations of using all FBML, which would have been ideal. Our wrapper now supports most of the calls. I am looking forward to check out your library. :)

Adam Webber

Posted on 8/17/2007 @ 8:42 PM
Hi,

It seems like you have written the NotficationService, but you have not exposed it from the FacebookService. Is this a bug or by-design?

If by-design, how can I get access to the NotificationService?

Ta,

Adam

Nikhil Kothari

Posted on 8/18/2007 @ 4:01 PM
Just getting back after a 3 week vacation... so a number of answers...

Andy: Sure its possible to use code-behind; I just chose embedded script to simplify samples (personal choice). The errors you are seeing are HTML validation warnings (not errors) since the HTML editor wants to see regular tags, which are missing in FBML pages. You're seeing them because likely you've got actual errors in your code. Trying filtering the task list to just see errors.

Lavanya: I didn't have to get a special skin. Using FBML gets the Facebook look and feel. Thats one of the pros of using FBML in fact.

Nik, Phillip - This is probably because you've got multiple pages in your iframe app. I will have fixes for this in the next release of Facebook.NET.

Adam: The notification property missing from FacebookService is a bug. Will be fixed in the next release.

Peter

Posted on 8/23/2007 @ 6:04 PM
I noticed that they've updated the api version and will be ending 1.0 (i forget the date but it's soon), not sure if this will affect your interface to the api just an fyi. I've enjoyed this wrapper thanks for making it available it eased me into making a facebook app. Now that I know a little more about whats what I'd like to help you on the project, let me know if you're open to giving that a shot alright?

Thanks again, good stuff.

Peter

Glenn Slaven

Posted on 8/23/2007 @ 6:46 PM
Nikhil, firstly thanks for this library, it's a great starter point for devs.

I'm having a problem with the GetUser command, the request is failing saying: "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"

SocketException (0x274c): 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]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +1028066
System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +431

Nikhil Kothari

Posted on 8/25/2007 @ 7:16 PM
Peter - I'll need to look at whether the version changes the affect API. As I understand, its just the FBML version #, and that doesn't affect the framework itself. I am all up for suggestions... and help (in terms of ideas, code and getting the word out) ... hence my experimentation with CodePlex.

Glenn - I haven't see the issue, but your description seems to imply that basically the request is taking too long, which maybe because of all sorts of delays on either your end or Facebook's end.

Alex

Posted on 8/27/2007 @ 1:31 AM
Great framework being developed here hope it continues to progress. However, I have just noticed something, I am trying to create a friend selector that only displays friends who have not added the app. There are provisions for this but when i am testing, when I have no friends remaining without the app added, I am getting a casting error. Things look to be pointing to
>>>--- ids.Add((string)idInfo[fieldName]); (FriendsService.cs ln97)
I'm not sure, maybe the facebook api is returning -1 or an error code for this case. Things work fine if the FreindFilter.AllUsers filter is called, it just seems to be in this scenario.

fillrobs

Posted on 8/28/2007 @ 2:23 PM
I'm baffled - I've installed it - I run it - it works as far as showing me the form - I select Hi, Hey or Hello and one of my friends (well my wife to be honest) - I click the Mini-feeds checkbox (or try not checking it) - hit send - it goes white - goes back to my profile (so I'm thinking Great - she should get a "Hi" in her mini feed - but nothing - nada - nothing happens... no errors - but no message.... I'm baffled...Please help is driving me mad....

p shastry

Posted on 8/28/2007 @ 3:07 PM
Hi Nikhil,

I just started developing a new application in facebook. I am using facebook developer toolkit. I downloaded your app too, but I am not able to open your application.
I don't have any version of visual studio compltely. I am using the visual web developer 2005 express edition which is available for free download. Please let me know how I can make your application work? It says the .csproj type not found etc. I have installed visual c# free download version also. But I am trying to open you .sln file in visual web developer 2005 express edition.
Please help!

Thanks,
Shastry

p shastry

Posted on 8/28/2007 @ 3:18 PM
Hi Nikhil,

Is there any method which can fetch me the list of users wall posts? I am not getting any help. Please help!

I checked at your methods, it only fetches the users count of wallposts. But I want to get the wallposts itself. Please help!

Shastry

Nikhil Kothari

Posted on 8/28/2007 @ 6:59 PM
Alex - could you log a bug in the CodePlex issues list, so it can be kept track of?

fillrobs - see if the notification appears on the news feed - the hello world sample app publishes an action to the mini-feed of the person saying hi, and a news feed item to the person recieving the greeting.

pshastry - Since you have VWD express, just use the sample web app and not the full solution. With VWD express you can develop Web apps, but not class libraries, or open solutions. And there is no way to get the wall post contents - see the Facebook API documentation for what is possible.

fillrobs

Posted on 8/29/2007 @ 4:29 AM
Ha - it turned out it was my Web Server - it didn't have Frontpage 2002 extensions installed and so it wasn't working correctly - however I now have sent a message and it appears in my Profile but not in the profile of my wife - does she have to add my application before it will work?

Tim Booker

Posted on 8/29/2007 @ 4:30 AM
Hi,

I am currently having the exact same issue as glenn, by the sounds of it.

SocketException (0x274c): 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]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +1028066
System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +431

i am currently at a workplace doing this, which is heavily firewalled, with lots of security etc - could this be the issue, and do you know if the requests extend beyond standard html requests on port 80?

regards,

tim

Nikhil Kothari

Posted on 8/31/2007 @ 12:38 PM
Tim Booker - all requests are over port 80 using HTTP. Assuming your firewall lets outgoing requests, it should be fine. The timeout exception essentially suggests either the connection could not be made, or there was no response in reasonable time.

By the way, on a different note, version 0.2.0.0 of Facebook.NET is now out on the codeplex site.

michael pair

Posted on 9/1/2007 @ 7:44 PM
I'm receiving an 'The page isn't redirecting properly' error when trying to access the fbml sampleapp. Is the a bug on FB's side or the FB.Net assembly? Or am I doing something wrong. I've been fighting this bug for 2 days....

Thanks.

Nikhil Kothari

Posted on 9/2/2007 @ 4:53 PM
Michael, which version are you using? I haven't seen this issue. Are you sure your app is on a public server where facebook can access it? FBML apps can't run off the local machine unless the local machine is publicly accessible...

Mark Eggers

Posted on 9/4/2007 @ 11:38 AM
Hi Nikhil,

Is it possible to get the the IFrame Hello World app working on a local machine which isnt publically accessible? Would you use creatingEventArgs.SetInfiniteSession? If so where do you get the information for UserID and SessionKey? Thanks a million. Mark

Nikhil Kothari

Posted on 9/4/2007 @ 7:27 PM
Mark, the infinite session key and associated user id are actual Facebook sessions and user ids. I can't seem to find the steps I had followed on creating an infinite session (the only tutorials I find right now are the PHP ones). I will try to dig it up, and post it.

So if you want to run an app outside the bounds of Facebook from a UI perspective, but in the context of a Facebook session, then creatingEventArgs.SetInfiniteSession gives that. If you want to run the app outside Facebook, and outside the context of a Facebook session, then it needs to be coded to look at FacebookApplication.IsSessionCreated before accessing Facebook objects.

michael pair

Posted on 9/4/2007 @ 8:45 PM
Nikhil,

I'm running on a local machine that has access to the internet. I've place my IP address in the call back url. I'm running IIS 5.1 on WinXP Pro. The IFrame works fine, however, I get this infinite redirect when running the Fbml example.

Any ideas would be appreciated. I've also seen the error displayed as invalid session.

Nikhil Kothari

Posted on 9/6/2007 @ 11:59 AM
Michael - the question is not whether your machine has internet access. Its whether your machine can be accessed by Facebook servers... in the iframe scenario, the browser on your machine is accessiing your machine.

michael pair

Posted on 9/6/2007 @ 12:38 PM
So how can I verify?

James Newton-King

Posted on 9/7/2007 @ 3:20 PM
I'm also getting an infinite redirect problem with the Fbml example.

Alex

Posted on 9/8/2007 @ 11:42 AM
i have noticed a small bug in the PhotoService.Upload method.. The parameter name for album id is incorrect. It needs to be 'aid' not 'albumID'. As a result, when you upload an image and try to upload to an existing album, it cannot be found and another is created. I have created an issue on codeplex. Also, i noticed that there was no method implemented for creating an album so i modified the source and added one. I can upload this if need be? Or i would be very interested in helping more actively with the development of this framework. Please contact me if so/let me know how i can.

Nikhil Kothari

Posted on 9/8/2007 @ 12:17 PM
Alex - please check out the new release. The particular bug with respect to albumID should have been fixed some while ago, and definitely for the 0.2 release. Let me know if that isn't the case.

In general for all readers, I definitely recommend tracking the progress of the project as well as logging bugs on CodePlex, and if you'd like submit patches for consideration.

Michael - try browsing to your machine from another location, such as from work perhaps, or ask a friend to do so... and see if your machine is accessible publicly.

James Newton-King - it would be great to try and track down the problem. Are you using the sample as-is? Could you log specific steps you took to customize the sample (i.e. specify the api key/secret for your app instance) etc. through a CodePlex bug?

Alex

Posted on 9/9/2007 @ 12:13 AM
sorry wasnt clear enough, its in the latest version of the source code uploaded at codeplex that i was going by not the release - FacebookNET-5486.

James Newton-King

Posted on 9/11/2007 @ 3:09 AM
1. Downloaded Facebook.NET 0.2
2. Extracted to directory
3. Created website in IIS 7, with app pool set to classic and the necessary host header
4. Replaced app key and secret with my own
5. Set callback to point at my site /fbml/
6. Browsed to my site /fbml/, redirected to Facebook, entered login details
7. Site and Facebook redirect to each other in a loop.

michael pair

Posted on 9/12/2007 @ 10:31 PM
Nikhil,

Thanks. For all of your help in getting this resolved. My machine is now accessible to the Internet. Since the IFrame example was working I thought I had connectivity. Thanks again!!!

Nikhil Kothari

Posted on 9/13/2007 @ 12:10 AM
James - if you follow the discussion with Michael and me on this post, you'll see that you likely have the same issue...

James Newton-King

Posted on 9/13/2007 @ 4:40 AM
I can access the website over the internet.

This is the URL that gets passed back to my site:
/fbml/default.aspx?auth_token=xxx

Dave

Posted on 9/13/2007 @ 12:24 PM
I'm having the same problem as James. I didn't change the code apart from putting in the key and secret and I'm running it from a server rather than localhost. It just redirects back and forth in a loop.

Nikhil Kothari

Posted on 9/13/2007 @ 1:12 PM
I wonder if something has changed in the auth sequence - will need to investigate. Definitely something to fix. Debugging is so fun with FBML apps... since they have to be on a remote machine... (being sarcastic). If either of you have collected information/clues about what might be happening please do share.

Justin Dunlap [C# MVP]

Posted on 9/14/2007 @ 1:23 AM
I have the same problem as James and Dave, and like them, the machine that hosts the app (and the app itself) is accessible to the internet. I'll let you know if I find out anything that could help in finding a solution.

Justin Dunlap [C# MVP]

Posted on 9/15/2007 @ 12:16 AM
Ok... I think I've found the solution to this problem. At least, I've got my application working. I was not very familiar with the workings of Facebook.NET, but I stepped through it and got a fair understanding of how things worked (nice work btw! :-) ).

After I figured out the basic structure, I realized that I couldn't find any code along the whole execution path for my FBML-based app that called the facebook.auth.getSession service method. I searched pretty thoroughly and found nothing. Then I looked in FacebookIFrameSession.Initialize() and saw that FacebookRequest.CreateSession() was called there:

-------
if (String.IsNullOrEmpty(sessionKey) || String.IsNullOrEmpty(userID)) {
string authToken = request["auth_token"];

if (String.IsNullOrEmpty(authToken) == false) {
FacebookRequest sessionRequest = new FacebookRequest(this);
sessionKey = sessionRequest.CreateSession(authToken, out userID, out sessionExpires);
}
}
--------

I changed my application's mode from Fbml to IFrame, and it worked, which indicated to me that I had found the problem. I copied the above code into FacebookFbmlSession.Initialize() and everything then worked with FBML as well.

I'm new to Facebook.NET, so correct me if I'm ignorant, but I'm confused as to how FBML mode ever worked at all before without that code being present, since there seems to be nothing else along that code path that creates a user session.

elif

Posted on 9/17/2007 @ 6:05 AM
hello,
how can I run the below lines.. the null part seems the USerID. But when I write there ...Service.UserID, the code returns null again..
what is the right way?

User user = fbApplication.Service.Users.GetUser(null, "name");
if (user != null)
{
Response.Write("2");
greetingLabel.Text = "Hello " + user.Name;
}

the second question, while trying to bind the friends list, the internet pages says using the following query:
SELECT name, uid from user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=@UserID)
but it is not working.

thank you again..

elif.

JSamper

Posted on 9/17/2007 @ 8:40 PM
Hello, I'm just starting
I've already downloaded Facebook.NET 0.2, but I don't know how can I integrate it with VS 2005, and use the controls in the Toolbox.
Please any help will be really useful.
Thanks, JSamper

Serge Ern

Posted on 9/18/2007 @ 8:36 PM
Hi Nikhil,
I need to create an event and add users attending to it, how do you believe it's the best way to do that? There isn't any class that allows that functionality, or do I have to do that manually in fbml. Any suggestions please??

Justin

Posted on 9/19/2007 @ 2:42 PM
I can't seem to get RefreshContentHandle to work. The following code works in php, but doesn not in .net. Am I doing something wrong? thanks!

php:

$facebook->api_client->fbml_setRefHandle("testhandle", "hello!");
$facebook->api_client->profile_setFBML("<fb:ref handle=\"testhandle\" />", $user);

asp.net:

protected void Page_Load(object sender, EventArgs e)
...

FacebookService service = FacebookApplication.GetCurrent(this).Service;
service.Fbml.RefreshContentHandle("testhandle", "hello!");

service.Profile.SetFbml("<fb:ref handle=\"testhandle\" />", null))

Justin

Posted on 9/19/2007 @ 4:47 PM
Looks like a bug in FmlService.cs line 38, "markup" should be "fbml". Also just noticed this bug has been posted to the issue tracker.

Dan Z

Posted on 9/20/2007 @ 6:35 PM
When I try to call fbApplication.Service.Users.GetUser(fbApplication.UserID, null) I always get a null User object returned. All of the other calls in the Service seem to be working correctly though. Any ideas?

Nikhil Kothari

Posted on 9/20/2007 @ 8:50 PM
James, Dave, Justin - the FBML mode bug should be fixed with the latest source code checkin on the codeplex site (I'll put together a release soon). I also fixed some other bugs reported on the issue tracker list. Justin thanks for posting the fix - the FBML app sample definitely used to work, without the code to use auth_token - perhaps something changed, and the FBML apps now behave closer to the IFrame apps?

Serge - don't know off hand how to add events, but if there are Facebook APIs to accomplish what you're trying, I'd recommend checking out their docs/wiki.

Justin - Fixed the RefreshContentHandle issue as well.

JustinM

Posted on 9/21/2007 @ 6:31 AM
Thanks for fixing the refresh handle!

Another question: does the library verify the signature of all canvas page requests by comparing the md5 hash of the request+secret to fb_sig? wiki.developers.facebook.com/index.php/User:24403391/Auth.

thanks!

Dan Z

Posted on 9/21/2007 @ 8:44 AM
Can someone help me? I must be misunderstanding a major concept or something...I'm writing an fbml based app and both of these lines below throw an object reference not set error:

FacebookApplication.GetCurrent(this).Service.Users.GetUser(null, null).Name;
fbApplication.Service.Users.GetUser(null, null).Name;

I just need to get the user's name but nothing works.

Nikhil Kothari

Posted on 9/21/2007 @ 11:33 PM
Dan - just a basic thought - did you get an actual api key/secret - just wondering if you started from the sample, which ships with placeholders for actual values...

JustinM - no currently the requests aren't verified.

Dan Z

Posted on 9/23/2007 @ 4:00 AM
AHHH...sorry to waste your time Nikhil. I copied and pasted the wrong api key from a different app of mine. It works now though. I have to say, I like your facebook component the best out of what's available today. Very nice work!

Mohammad Eqbal

Posted on 9/27/2007 @ 4:57 AM
I know that u r very busy Nikhil,

But I'm trying to figh this problem for more than a week.
I'm trying to develop an FBML application using ur Facebook.Net laibraries
but still have the same error msg


Errors while loading page from application
Received HTTP error code 403 while loading //jeeran-inc.com/TestJeeranBlogger_V1/default.aspx

There are still a few kinks Facebook and the makers of AgainAndAgain are trying to iron out. We appreciate your patience as we try to fix these issues. Your problem has been logged - if it persists, please come back in a few days. Thanks!


any help would b really appreciated

And Sorry for the headech

Regards

Mohammad Eqbal

Posted on 9/27/2007 @ 11:15 AM
Another thing I would like to ask u about Nikhil,
I'm trying to develop an application that transfer some posts to facebook profile, and I need it to do that directly (when the user login to his facebook account) instead of clicking to the application icon to load it, in other words I need the application triggered on when facebook user login to his account. How can I do that plz?? The application that I intend to make is very similar to Digg facebook application in the concept .

We are totally grateful for your inspiring thought and your continuous support.
And I really appreciate your willing to help.

Prashant Kamboj

Posted on 9/27/2007 @ 11:16 PM
I used the FBML for my application which have <asp:fileupload> for image and at the submit it does'nt take the image and shows the value is null.
Sort this if u can.

bonder

Posted on 9/30/2007 @ 12:48 AM
Hi guys, is anyone having a problem similar to this:

I have implemented several pages all tied together through a master page with links to allow the user to move among the pages.

So far, so good. I can click the links and get to all of the pages.

However, on one page I added a button and a label (initially invisible). The button has an onclick event that simply makes the button invisible and the label visible.

This works fine -- I click the button and the label text is displayed. However, if I try to click any of the hyper links to go to any of the pages (including this page), I get the "You've already added (app) to your Facebook applications."

Any thoughts? I have the feeling it's something simple, but so far I'm not seeing it. :)

--Bruce

Christian Palouda

Posted on 10/3/2007 @ 10:02 PM
My ISP requires all HTTP requests to go through a proxy server that they have set up. Is there a way within the FaceBook.NET framework to force the requests through that proxy?

Sergei

Posted on 10/5/2007 @ 2:01 AM
I got the following error when ran the sample
Error 1 Unknown server tag 'fb:FacebookApplication'.
To fix it I added this line on top of the Default.aspx
<%@ Register TagPrefix="fb" NameSpace="Facebook.Web" Assembly="FacebookNET.Web"%>

Cheers,
Sergei

Nikhil Kothari

Posted on 10/5/2007 @ 8:47 AM
Mohammad - You'll need to look up exactly what 403 means ... can't remember off the top of my head, but basically your server is blocking the Facebook server from accessing your content in some way. For your scenario, you need to look into infinite sessions. Just search for that.

Prashant - not sure if you can use file input in FBML - ask on the FB developer group.

Bonder - make sure you're using FacebookHyperLink controls.

Christian - Set the proxy settings you need to use in config - there is a system.net section you can use... you'll need to look up the exact section name/attribute names in msdn.

Sergei - did you add the assembly to the bin directory?

Serge Ern

Posted on 10/5/2007 @ 10:18 PM
Hi. I need to know how can I send an email inside Facebook, because there is a NotificationsService.Send(string userID, string notification, string email)
method, but I can't understand if that notification is message in Facebook Inbox. And if it is not, the email is any outer email address? Any way, how could i get a users friend email?
Thanks , Serge

Mohammad Eqbal

Posted on 10/7/2007 @ 3:35 AM
Hi,

Can I make a link from profile page to another page within facebook canvas ??? cuz I did that and the problem that the linked page viewed as an independent page while I need it to shown within a facebook canvas,
I can't ether use <fb:FacebookHyperLink > tag cuz I'm restricted with FBML tags only with profile page using Profile.SetFbml methode .

Any help plz ????
Thanks

JustinM

Posted on 10/12/2007 @ 10:09 AM
Just curious why there is a hard requirement that if the Facebook.NET control is loaded on a page that the user must install the app. Facebook allows the canvas pages to be viewed without having the app installed. I tested the fbml session after disabling the add app redirect and it appears to be working.
thanks.

Nikhil Kothari

Posted on 10/12/2007 @ 5:01 PM
Justin - no good reason... supporting the not-added-app-scenario should be supported... something to add to the codeplex list.

DH

Posted on 10/14/2007 @ 12:28 PM
Unable to cast object of type 'Facebook.Service.Core.JsonObject' to type 'System.Collections.ArrayList'.

The following code compiles fine:
protected void Page_Load(object sender, EventArgs e)
{
FacebookApplication fba = (FacebookApplication)Master.FindControl("FacebookApplication");
FacebookService fbs = new FacebookService(fba.Session);
UsersService usr = fbs.Users;
FriendsService frds = fbs.Friends;

string usrId = Request.QueryString["fb_sig_user"];
User u = usr.GetUser(usrId, "uid,about_me,activities,affiliations,birthday,books,current_location,education_history,first_name,hometown_location,hs_info,interests,is_app_user,last_name,meeting_for,meeting_sex,movies,music,pic,pic_small,pic_big,political,profile_update_time,relationship_status,quotes,religion,sex,significant_other_id,tv,work_history,status,notes_count,wall_count");
LabelUserInfo.Text = String.Format("Welcome {0} {1}. Your ID is [{2}]", u.FirstName, u.LastName,usrId);

ICollection<string> f = frds.GetFriends(FriendFilter.AppUsers);
foreach(string item in f)
{
CheckBoxListAppFriends.Items.Add(item);
}

But when I run the page from facebook i get the following error:
Unable to cast object of type 'Facebook.Service.Core.JsonObject' to type 'System.Collections.ArrayList'.

Line 30 is marked red!

Line 28: LabelUserInfo.Text = String.Format("Welcome {0} {1}. Your ID is [{2}]", u.FirstName, u.LastName,usrId);
Line 29:
Line 30: ICollection<string> f = frds.GetFriends(FriendFilter.AppUsers);
Line 31: foreach(string item in f)
Line 32: {

Any ideas what is causing the error ?
Thanks

abhishek kant

Posted on 10/15/2007 @ 7:52 PM
i am using Facebook NET client library in the iFrame mode. WHile i have been able to create the default.aspx page working fine, i am now trying to create the post add page. i have included the FacebookApplication control in the postadd.aspx page. after creating the page when i add the application to the profile, i encounter the following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------

The ApplicationKey must be set during page initialization.
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: System.InvalidOperationException: The ApplicationKey must be set during page initialization.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InvalidOperationException: The ApplicationKey must be set during page initialization.]
Facebook.Web.FacebookApplication.OnPageInitComplete(Object sender, EventArgs e) +690
System.Web.UI.Page.OnInitComplete(EventArgs e) +2057308
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +821

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832


Could you advise on how to proceed?

cheers
Abhishek

Joyce Zhang

Posted on 10/16/2007 @ 8:49 PM
Hi NikhilK,

I posted a question on Facebook.Net but nobody answered, really need your help here. the problem is:

i managed to send an invitation in iframe mode, but there is no "confirm" button in the invitation message which allows friends to accept. there is only the "ignore" button. the code is like this:

Notifications.SendRequest(uid, "invitation", "Invitation message", "image link", True)


thanks

Gary Tovey

Posted on 10/17/2007 @ 2:51 PM
Phillip states above that 'The latest release is very well documented.'. I haven't found any documentation. I didn't see any in the download, can someone point me to it?

Thanks

Manjit Dosanjh

Posted on 10/18/2007 @ 3:18 PM
Just an idea when debugging FBML applications. Nikhil said he had to install on a remote machine because it has to be publicly visible. Why not get a fixed IP and then install a web server on the local machine and, surely, that allows you to debug the application locally. Or have I missed something?

Manjit D

JustinM

Posted on 10/22/2007 @ 7:14 AM
Manjit,

Yes you can debug locally with fbml apps. What I did is get a free dynamic dns (gotdns.com), port forward port 80 (actually in my case port 8080, as some other machine is using 80) directly to my development laptop that has IIS running (Vista Ultimate, note the Application Pool may need to be set to "classic"). Then made a local dns entry in windows\system32\etc\hosts file to have the dns entry point to 127.0.0.1 for resolving url's that point directly to my site (images). Everything works fine.

Alex L

Posted on 10/22/2007 @ 3:22 PM
Hello,

Many of the Facebook API REST functions return multiple error codes. However, I noticed that the Facebook.NET functions call CoerceBoolean() when returning a result. Does this effectively lose the additional code status information?

Thanks,
Alex

karthikj

Posted on 10/23/2007 @ 11:29 AM
I have used GetPhotosOfUser(UserId) method in Facebook.Service.PhotosService class to get tagged photos in System.Collections.Generic.ICollection<Facebook.Service.Photo> object. Could u plz tel me how to display those. photos.C# code is given below

System.Collections.Generic.ICollection<Facebook.Service.Photo> getTaggedPhoto = tagPhoto.GetPhotosOfUser(FriendList1.Friends4.UserId));

I would like to know whether we can use any other way to display tagged photos.

rahul

Posted on 10/27/2007 @ 2:17 AM
I get this error code and error message (shown below) on calling auth_getSession($auth_token), can anyone please share possible reasons for this? I see that I do get values of api_key, session_key, call_id and all the required parameters. but the error message is still there, sort of weird, any clue?

[error_code] => 100
[error_msg] => Invalid parameter

chetan

Posted on 10/29/2007 @ 7:07 AM
Hi Nikhil - I really like your blogs and am a .NET Analyst in Mass. I would like to know where is the best place to start, so that I can understand the FBML and its API's ? Is there a demo project which I can download and run on my localhost which would exactly replica Facebook. (I believe FaceBook.com runs on PHP). I prefer both the C# and VB.NET version.

Please advice.

Thank you!

Dating-dude

Posted on 10/30/2007 @ 1:08 PM
I'm testing the sample app that come with the library. I found something extra weird, sometime it works, sometime it does not. Yesterday, I got "object reference not set" today I got "null url".

System.Uri..ctor(String uriString, UriKind uriKind) +1683538
Facebook.Web.FacebookIFrameSession.ResolveUrl(HttpContext context, String url)

Is the facebook not being consistent or the dotnet code is not really working with fb.

muja

Posted on 11/3/2007 @ 8:53 AM
hi Nikhil,

thanks for the api. i am trying to do everything in code behind and i dont know how to get the session initialized. Please help... heres is my sample code.

protected void Page_Load(object sender, EventArgs e)
{
Facebook.Web.FacebookApplication fb = new Facebook.Web.FacebookApplication();
fb.ApplicationKey = "my key";
fb.Secret = "my secret";
fb.Mode = Facebook.Web.FacebookApplicationMode.IFrame;
fb.EnableExternalBrowsing = true;
fb.ApplicationName = "helloWorldIFrameApp";
Response.Write(fb.IsSessionCreated); // i always get false here

Qur'an

Posted on 11/11/2007 @ 1:10 AM
Hi Guys..
anybody knows how to use <img> tage in FBML page .. i'm trying to desplay a picture in profile but a blank image desplayed instead ...

any help plz ?

Dustin

Posted on 11/13/2007 @ 2:03 PM
Hey Nikhil,

Great framework. It has made everything I have been doing much easier. I have a couple questions from lack of documentation on Facebook's side and was wondering if you had come across the answers.

1. I have tried developing an FBML Application with an <fb:iframe> which hosts some aspx pages I have. No issues with hosting, however when I try to access the user's profile for inside the iframe, I get the error "Session Key invalid or no longer exists". I was wondering if you had any ideas on that one.

2. I was wondering if you had any plans to pipe through the functionality that FBML offers such as the multi-friend-selector or modal window to name a couple.

Thanks,
Dustin

Dan Z

Posted on 11/16/2007 @ 11:17 AM
Qur'an...are you using absolute paths for you images? Relative image tags will not work in fbml.

muja...I usually try to do everything as an fbml app but I think you have to set the session information in your facebookapplication object - fb.Session.
The important field in the fb.Session object is the SessionKey field. You should be able to get it by Request.QueryString[""fb_sig_session_key"];

veroljub

Posted on 11/16/2007 @ 1:35 PM
Great work!!! You made Object Model, whole teer on facebook api. I looked at code with Reflector, really must give my best regards for work!!!

I am programming some kind of .NET SQL Database broker. His main role is to passive one instance of Facebook.Service.User in Sql row or back (in example)

Now what is my problem. I wanted to make new User from database and when I tried to initialize User I couldnt do it because there is no constructor.

My questions are: Why constructors do not exist? And how can I do pass this think?

Here is some abstract code if I You didnt uderstand me:
DataSet.UserTable usersDT = Adapter.GEtUser(); //get my previouse recorder users
foreach userRow in usersDt
{
Facebook.Service.User u = new User() // not possible
MappDesiredProperties()
Add to List and work with objects in memory....
}

Kevin

Posted on 11/19/2007 @ 7:05 AM
Hi Nikhil,

I was wondering if your framework supports facebook pages. I did not find anything to set the fbml on a page's profile. Is this possible at this point?

Thanks

veroljub

Posted on 11/19/2007 @ 6:48 PM
I will answer myself for future readers.
Constructor do not exist because you should not user this object (User, Album,..) in your application for you conceptual model. Just like you do not have permission to insert data in fb database, you do not have permission to create objects that represents database data.

In fact, you must build your own structure and replicate data from fb databases (using framework provided by Nikhil) in desired way (in example - just catching some basic user fields and mapping to your object FbApp.Service.User -> YourUser).

So, conclusion is that my way was logical mistake. You should map Fb.User into your
User class and not opposite like I tried.

Nagarajesh

Posted on 11/20/2007 @ 11:51 PM
Hi! i found an msg that "Friends: XML returned by Facebook is empty!" while i create an application with the help of FacebookService Component to populate Friends in ASP.Net. And it can't show my friend's list... pls help me.

Nikhil Kothari

Posted on 11/21/2007 @ 8:40 AM
Kevin on Facebook pages - absolutely... I do want to add support for the new APIs added by Facebook in that area, as well as support creating apps specific to Facebook pages.

Dustin - Same goes for newer FBML features such as the friend selector.

I'd recommend checking out the code on CodePlex, and helping where possible for quicker turnaround. Even if its not actual code, any initial investigation/thoughts on best way to model a feature as well as help providing more detail on a bug is always useful - it saves some initial leg work, and that will help get things out faster.

Also, for a number of specific issues being raised here, the issue tracker and discussion forums with threaded conversations is a better channel. The comment stream is more suited to higher level discussions on Facebook, Facebook.NET and this post.

Thanks!

omer

Posted on 11/30/2007 @ 3:20 AM
hi nikhil,

thanks for this blog it's very helpfull.

i want to put the FacebookApplication control in my masterpage but when i do this i
allways get the fbApplication.IsSessionCreated -> false

what am i doing wrong?

omer

Posted on 11/30/2007 @ 4:21 AM
so i found what was my problem,
i have used a default page to redirect to my main page who uses my master page.

then i dicidd to loose this default page and everythig works fine.

Jerome Paradis

Posted on 12/3/2007 @ 6:56 PM
Hi Nikhil,

I love your Facebook Framework!

Is there a way to easily map a FBML result object to an entity? You already did the job to extract the information returned from Facebook request and we don't always want to make API requests because some FBML requests will save us roundtrips.

For example, to get a list of users, one way I found to map a FBML request to the user class is to modify the user class so that the constructor is public instead of internal and do something like the following:
List<User> users = new List<User>();
object results = friendStatuses = fbApp.Service.Fql.ExecuteQuery(.......)
foreach (object result in (IEnumerable)friendStatuses)
{
User user = new User((Hashtable)result);
users.Add(user);
}

Is there already something similar to do this?

Ronny

Posted on 12/5/2007 @ 11:34 AM
I installed Facebook Developer Toolkit 1.5 and Visual C# 2008 Express. But the FacebookService doesn't show in my Visual C# toolbox. I saw a "get started" video, and the guy was using Visual C# 2005 Express. Is this a 2008 problem or have I done something wrong ?

Chaminda Chandrasekara

Posted on 12/6/2007 @ 3:31 AM
Hi Nikhil,

We have succesfully implemented a very interactive appplication using asp.net for facebook using your Facebook.Net dlls.
apps.facebook.com/fblistapp

Thank you so much for giving us a grate set of dlls.....

It is fantastic...

Chaminda

Rajani Karthik

Posted on 12/11/2007 @ 10:36 PM
Hi Nikhil, through notification i am able to send msg to news feed and mini feed. but that msg comes to my news feed. but i want it to send message to my friends news feed.

can u pls tell me where userid is to be mentioned to do so

natraj

Posted on 12/14/2007 @ 3:23 AM
Nikhil, is there any way to post on my friends wall other the FB way? I mean does the API support any method for this?

milind

Posted on 12/14/2007 @ 11:30 PM
Hello Sir,

I got following error

Errors while loading page from application

Received HTTP error code 500 while loading My Applicationurl .
There are still a few kinks Facebook and the makers of FBMLTEST are trying to iron out. We appreciate your patience as we try to fix these issues. Your problem has been logged - if it persists, please come back in a few days.
Thanks!

This error i got ,when i try to run FBML application.
Can you tell me , how to sort out this error.
Please help me, i m new in Facebook.NET development.

Thanks
Milind

mido

Posted on 12/21/2007 @ 6:06 AM
Hello,
How can I use url parameters in IFrame application with asp.net?

vijay

Posted on 12/24/2007 @ 1:27 AM
Hai Nikhi you have done very great
i used u r suggestion i took a lot benefit.
thanks

vijay

smarie

Posted on 12/26/2007 @ 12:08 PM
I have received a HTTP 500 error code while loading my Default.aspx page from facebook. I've been working on it four hours and I have no clue how to sort it out. I've checked my code to see if it was correct and it is. Please help me!

phillip

Posted on 12/28/2007 @ 7:42 AM
Thanks for keeping this up-to-date. The other guys are doing a terrible job, in that regard. I'm making the switch back to facebook.NET. Keep up the great work. I know it's extremely hard to keep up with the changes that facebook makes, and I'm very happy that someone is taking initiative.

Charles Chen

Posted on 12/28/2007 @ 5:11 PM
Recently, I try to use Facebook.Net to develop an application. When I use FacebookApplication.Redirect(control,url) to redirect from current page to another page, there is a mistake. I try to add one line code in the method "private void Redirect(string url, bool detectRelativeUrl)":

HttpResponse response = Page.Response;
response.Clear(); //Added by me
if (InCanvasPage) {......

Then it's OK.
Maybe this is a small bug in FacebookNet, hope this can help someone.

stephen

Posted on 1/3/2008 @ 3:52 AM
Hey Nikhil

Brilliant library. Currently, when I call fbApplication.Service.Users.GetUsers(FFriends, null), Most of the response fields are missing. I know the response sent back depends on the user preference etc, but I tested it on my profile and I cannot get fields such as "pic_square,pic_small,pic_big,pic,sex" which maps to SquarePictureUrl, SmallPictureUrl etc. Do you know what I am doing wrong? I have also tried to use specific fields instead of null but it does not work either.

arun

Posted on 1/5/2008 @ 1:51 AM
Hi,

i get this error when i open my facebook sample application. how to fix this

[NullReferenceException: Object reference not set to an instance of an object.]
Facebook.Web.FacebookApplication.Render(HtmlTextWriter writer) +140
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +245
System.Web.UI.Page.Render(HtmlTextWriter writer) +37
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4701

arun

Posted on 1/8/2008 @ 2:47 AM
hi,

i set my facebook application externalbrowsing to false. when i request the application through
apps.facebook.com/appname, it goes to facebook login.

After log into facebook, it always redirects the page to www.facebook.com/add.php.

how to fix this

Anh Tuan Ngo

Posted on 1/13/2008 @ 7:56 PM
Hi Nikhil!

I have some problems with Facebook. I want to get Facebook friend to my page. If friend's number is small, there is nothing happened but if friend's number is large, there is an error:

Error while loading page from Energy Meter Page
The URL ... did not respond.

There are still a few kinks Facebook and the makers of Energy Meter Page are trying to iron out. We appreciate your patience as we try to fix these issues. Your problem has been logged - if it persists, please come back in a few days. Thanks!

How can I do to fix this?

Maryrose Beirne

Posted on 1/14/2008 @ 1:53 PM
I had the "Error while loading page from .. " problem as well. I fixed it by removing extra slash " /" from the Side Nave Url and Post-Add URL.

Jason Dever

Posted on 1/14/2008 @ 11:15 PM
Has anyone ported the c code to vb? And created a starter kit in vb?

Anh Tuan Ngo

Posted on 1/15/2008 @ 1:30 AM
Thank all!

My problem is resolved. I think because friends' number is too large, so my page load very slow and ... Time out. I try to paging this page and everything's ok!

anas

Posted on 1/15/2008 @ 4:00 AM
hi

pubudu

Posted on 1/16/2008 @ 12:43 AM
I am using a ASP.Net website I need to develop a plugin once I clicks on the button from the website then that plugin should get the user name and e-mail address from my ASP.Net web site if username and e-mail are tally the face book username and e-mail address and it should updated the picture to face book that picture should get from my website.
Can any one guided me to achieve this?

Thanks
pubudu

ok_john

Posted on 1/16/2008 @ 10:30 AM
even if i simplified all the code, when i call "User user = fbApplication.Service.Users.GetUser(null, "name");" return value is always null..not only the "GetUser" all other calls return null (Events etc..)..i checked api_key, and secret and they are correct..plus, "FqlDataSource" control also doesn't work (returns null)..even though i can get UID and UserPageURL like properties, thats not enough for my app., i need to reach other user information(friends,events, etc..)..

Viktor Gushlekov

Posted on 1/17/2008 @ 6:19 AM
Hi FB coders,

I have a simple question: Is there anybody that tried to create a popup from a HyperLink in FBML type application?
I tried several ways to solve this problem but it seems javascript allowed by FB restrict using of window object.
Note: The aim is to use window.open function.

Thanks all in advance.

Moustapha Houry

Posted on 1/23/2008 @ 4:30 AM
Hello Nikhil,

It seems like I am facing the same problem as Glenn and Tim Booker before me, but I haven't seen a fix for it yet.
"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"

It looks as if the response could not be received in a specific amount of time. Maybe because the response is simply too long (like a friends' list with more than 240 friends...who knows).

Is there a way to increase the "wait" interval or maybe some1 else found another solution for this.

btw, yes I am behind a firewall but ports 80/443 are opened both ways.

Mandar

Posted on 1/24/2008 @ 6:50 AM
Hi

i m trying to implement fb sample application in asp.net with helloworldfbml stuff, i am getting an error following: 'Error Creating Control - fbml No 'runat=server' attribute present on the fbml tag.

pls help

Chirag

Posted on 1/25/2008 @ 1:36 AM
I read full article i get the idea about the how to start with facebook nice article keep
helping like this thanks..

Josh

Posted on 1/30/2008 @ 5:30 PM
Thanks for putting this together! Using this framework, I created a light weight project management system for Facebook named Toodooz. Very cool implementation.

Check it out at: apps.facebook.com/toodooz

Thanks Again,
Josh

Muhammad Kashif Abdullah

Posted on 2/8/2008 @ 2:12 AM
I am creating application using facebook.net in iFram mode.What i have a problem is when data grow a ugly scroll bar appear on right side of application. What i want is to hide those ugly scroll bars that get with an Application.

Muhammad Kashif Abdullah

Posted on 2/16/2008 @ 12:23 AM
Hello please is there any solution for my problem. Any one help.....................

Atul Katare

Posted on 2/19/2008 @ 1:04 AM
Hi Nikhil
How to create facebook built in invite page for sending newly crated application to Friend's
and is it possible inside iFrame
Thanks..

Sachit

Posted on 2/22/2008 @ 4:32 PM
Hi Nikhil,

I am new to facebook development

I have created an application using dotnet. But iam not able to display it on facebook canvas area

please can you help ? It is really urgent.

ram

Posted on 3/3/2008 @ 1:34 AM
Hi Nikhil,
Can we access the Wall postings of a user using the FaceBook API? Is there any other method for it... Please give your suggestion.

Dustin Savery

Posted on 3/3/2008 @ 10:36 AM
>> Muhammad Kashif Abdullah

The only way to rid your application of the scroll bar is to create your application in FBML mode, create a simple FBML page with an <fb:iframe> tag inside that will house your page. Facebook by default sets any iframe content into one of those tags on their servers which uses "smart sizing" which basically sizes your frame to allow enough room for the footer links on the page. When you do your application in FBML mode, you specify to not use the smart sizing and you can then make your frame as large as you want. However, since Facebook prevents crawling the DOM, you will need to set it to your tallest height so that everything will show in any scenario.

Shradha S

Posted on 3/31/2008 @ 1:40 PM
I am glad to find an API which works with microsoft technology like vb.net and asp.net
But i am not able to find a method where i can upload videos. My Website shall select videos as per user's choice and it gets to upload to facebook account/ profile.
Could somebody help me on, how does api or other mechanism work for uploading videos through code.

Help needed urgently,

Nikhil Khankhoje

Posted on 4/8/2008 @ 9:26 AM
http://www.codeplex.com/FacebookNET/WorkItem/View.aspx?WorkItemId=1490

although i am using the 0.3.0.0 release i am still facing the Invalid Redirect - IFrame Application issue.

Could you please help?

miriana

Posted on 4/9/2008 @ 12:09 AM
hi that's a great website

miriana

Posted on 4/9/2008 @ 12:10 AM
HI I WANT TO SUBMIT

Confused

Posted on 4/10/2008 @ 2:01 PM
I'm having similar problems to Ronny who posted this message:

[I installed Facebook Developer Toolkit 1.5 and Visual C# 2008 Express. But the FacebookService doesn't show in my Visual C# toolbox. I saw a "get started" video, and the guy was using Visual C# 2005 Express. Is this a 2008 problem or have I done something wrong ?]

Could anyone give suggestions?

Nikhil Khankhoje

Posted on 4/11/2008 @ 4:20 AM
after a lot of efforts .. i got the invalid Redirect - Iframe application issue resolved. Strangely changing the filename from Myitems.aspx to MyItemlist.aspx did the magic... bt don't know the reason behind such behavior.

Thanks anyways ... Nice framework

Shaun Walker

Posted on 4/15/2008 @ 11:33 PM
I used Nikhil's Facebook.NET framework and created an application which I submitted last week to the Application Directory. The app is called Top Visitors and it allows you to track the Visitors to your Profile. Since submitting the app to the Facebook Application Directory it has already grown to 5000 unique users in 1 week! There is definitely an exponential growth curve which kicks in for Facebook apps which have compelling functionality. I want to thank Nikhil for his efforts and remind people that we need to be respectful and grateful to developers like Nikhil who are willing to share their time and effort for the benefit of the community.

Faisal

Posted on 4/17/2008 @ 11:56 PM
Hi
i have used facebookNet to develop two of my applications so many many thanx to you.
But one issue which i am facing now a days i can't mail to my app users from facebook can you please add the new method notifications.sendmail to your library. thanx in advance

John Attew

Posted on 4/23/2008 @ 7:52 AM
Hi,

I am a specialist recruitment consultant based in London for .NET/ SharePoint and Front end development skills. I am looking for an ASP.NET Developer with FBML experience to work on facebook applications for a New Media's leading global client. The first stage is to start on the 12th May for initally a month and potentially continue if your work is to a high standard.

If you are interested or know of anyone that is please forward on my details or send me your CV to john.attew@gcsltd.com or call 02077104141.

I know this is a rather unorthodox thing to do on a forum but I am finding it hard to find good quality candidates.

Thanks for your time

John

Zubair.NET!

Posted on 5/7/2008 @ 3:45 AM
hi Nikhil

I have posted this question many times and tried to post it here in the comments but your form does not allow me to post but I ll try again now.

I posted on the discussion hoping to get an answer to a simple question but till date no luck.

hope you can answer this www.codeplex.com/FacebookNET/Thread/View.aspx?ThreadId=26706

thanks for creating a wonderful tool.

Chris Treadaway

Posted on 5/21/2008 @ 5:23 PM
I've seen a few comments in this thread about ASP.NET development... the lack of a good "friend picker"... the lack of social media development talent.

I left Microsoft in mid-March to join a social media company, Notice Technologies (www.noticetechnologies.com). We have a high-performing tiger team of devs who has worked in iframes/ASP.NET Facebook development for the better part of a year... so they understand the ins & outs of getting things done quickly. We also have viral marketing expertise on the team so we can help with the marketing of apps as well.

Feel free to contact me at chris@noticetechnologies.com if you need help.

Chris

Suresh

Posted on 5/30/2008 @ 12:19 AM
Hi Nikhil,
I download your sample code and run it gives error "Service can only be accessed after a Facebook session is established."
Please help

nesro

Posted on 6/19/2008 @ 1:42 AM
dear sir
pls tell me...
Is it possible to login My application using FaceBook User ID and Password?
thanks

Sicoe-joe

Posted on 6/26/2008 @ 5:26 AM
Hi there guys, does anyone know of any backroots to get into facebook. My server blocks it, and perhaps there's a way in which I can get in undetected!!!!!!!!!!
The discussion on this post has been closed. Please use my contact form to provide comments.