VS.NET starter kit for Nikhil Kothari's Facebook.NET


Back in July Nikhil Kothari released Facebook.NET which is an ASP.NET wrapping of the Facebook API. Facebook.NET is a bit different approach than Facebook Developer’s Toolkit and provides some ASP.NET controls that wrap some of the more useful elements of the FB API. Nikhil and I exchanged a few emails back in July and he asked if I’d put this together but I’d just started a new job and was in the midst of remodeling my house and now things have settled down I decided to get it out

Use of this starter kit is very close to the previous one I released. The kit includes a Welcome.htm which is displayed in VS.NET when you create a new application that has all of the details of getting the two flavors of FB application (IFrame and FBML) up and running. One note, I tweaked the FB API version in FBML\Default.aspx since “0.3” is no longer supported.

Let me know if you have any problems. Download

[UPDATED: Jan 14, 2008] I updated the Starter Kit to v0.3 of Facebook.NET. Additionally, the starter kit has been updated to VS.NET 2008

[UPDATED: May, 6, 2008] Here are some additional links:

60 thoughts on “VS.NET starter kit for Nikhil Kothari's Facebook.NET

  1. Hey,
    Ive just downloaded your facebook starter kit and managed to get it up and running, but when I go to fill out the optional fields, the only section I get is Base Options and none of the others?
    It may be because Facebook hasnt installed the developer app properly (it doesnt show up in my apps and I have to add every time from the devlopers link at the bottom of the screen…)
    Any ideas whats going on?

  2. Hi Karl,
    Looks like I forgot one step (which I’ve added to Welcome.htm and updated the Starter Kit) which is, under Base Options to set "Can this application be added to Facebook?" to "Yes". That will cause the additional options to appear. It’s very obscure, I agree.

  3. hi
    i downloaded the starter kit above.
    Then i opened Visual Studios and clicked on File – New – Website – and then selected the Facebook.NET template.
    Then i clicked on the play button to debug the application. All it did was load the login page to facebook displaying a message saying "Invalid API…"
    What should I do?
    Thanks

  4. i’m trying to download the file but it is not working it gives me the following message "can not load file or assembly MicroSoft.WizardFrameWork ………….."

  5. Carlito,
    You need to be sure to follow all of the detailed instructions in Welcome.htm. I’ve had lots of people use the Starter Kit successfully so I know all the details are there.
    Your local URL will be specific to your application. In the example you’ll need to supply "nnnn" which is the port number and "MyApp" which is your applications virtual directory.

  6. hi steve
    thanks for your replies.
    i think i have made some progress but i have encoutered another problems that is stalling me in my quest to conquer this facebook stuff.
    I have completed all the steps on the welcome.html page including the "Configuring your application" section. But no luck. What is the application that you have created suppose to do?
    What I keep getting when I go to http://apps.facebook.com/Facebook.NET1/
    is "The page you requested was not found."
    What do you suggest I do now?
    Thanks for your help so far.
    Look forward to your response.

  7. Hello,
    Installation of VSI seemed to be successful (devenv closed), but then I couldn’t find it (not in create project, not in create web site).
    I also tried "devenv /setup" and "devenv /InstallVSTemplates", but didn’t help.
    Any suggestion?
    Thanks

  8. sorry for double post.
    i think i figured out why it didn’t work: ZIP files reports CRC errors when I tried to manually unzip it.
    I am running this on Win 2003 Srv, thought I doubt this is the issue

  9. Boy am I lost… How do I work with Facebook.net under the webdeveloper studio? I down lost the vsi but its only for c#, is there one for vb? What reading do you recommend for complete noobies.

  10. Aldo,
    Facebook.NET is just an assembly like any other, it does have a few controls that can be added to your toolbox but that’s neither here or there really. The starter kit is intended to help you get a project up and running quickly so just create a new website and look at the project files.
    I’m not familiar with VB so, no there is no VB version though since there is hardly any code converting this version to VB should be a piece of cake. I supposed I could create a VB version but that’s not high on my list right now.
    To successfully write Facebook applications you should familiarize yourself with the Facebook API and not just Facebook.NET.
    Shem,
    Why can’t you install it? As I mentioned above there is hardly any code in the app so converting it to VB should be a no-brainer.

  11. Steve,
    I added the callback URL to my app in facebook as:

    http://localhost:nnnn/MyApp/default.aspx

    and I am using the Hello, World! example from Facebook.NET (using iframes). The app’s initial canvas page works, however when I click on the link to "Browse Photos" which is defined in my default.aspx page as:
    <fb:FacebookHyperLink runat="server" id="photosLink" NavigateUrl="Photos.aspx" Text="Browse Photos" />
    … I receive an HTTP 404 – not found error, and the debug info shows the following requested url:

    Requested URL: /TestApp/default.aspxPhotos.aspx

    Why is facebook treating default.aspx as root? (I tried taking default.aspx out of the callback URL string, this doesn’t work either)
    Thanks for your help

  12. Great work Steve. It seems like a small thing, but this kit will be a huge jumpstart for a lot of developers. Your work is much appreciated.
    I’ve got to concur with the suggestion about the callback URL. The best strategy is sans page name.

  13. Hi drasticp,
    Thanks! I’m glad you’ve found it useful. I just uploaded a new version which fixes the Callback URL documentation and tweaked the Starter Kit so that it opens Welcome.htm upon the creation of a new Facebook.NET web site.

  14. Hi,
    Thank you for your article.
    My question is about Facebook Toolkit of Microsoft.
    Do you have any idea about, how to display multi-friend selector for inviting people in IFrame based applications?
    I did it in FBML application, but because postbacks, scripts etc are not allowed in FBML, it does not fulfill with my needs.
    Can you please help?
    Thanks

  15. Steve,
    Are you updating your VS tool with the pathces and updates at nikhil FacebookNET library?
    I am new in this, if i downlaod nikhi’s new source-relese and compile the dll, how can i add that to your tool without causing any trouble.
    Taanks a bunch!

  16. Hi alam,
    The starter kit is up-to-date with the binary 0.2.1.0 release of Facebook.NET which is the latest release from codeplex. If the assemblies are updated all you should have to do is download them and overwrite the existing versions.

  17. Do you have any basic code for default.aspx.cs that would demonstrate how to get the usersid, list of users friends, etc?
    I’m trying something simple like this in _load:
    Facebook.Web.FacebookApplication fb = new Facebook.Web.FacebookApplication();
    this.lblUser.Text = fb.Session.UserID;
    Really interested in this, and a bit hesitant to try the Microsoft.NET toolkit.

  18. Hi Steve
    Good work done.
    I have a doubt in this. I have created my own application in Facebook and when i open the application it works fine.
    1. But when i submit my application to the Directory the following message appears
    "Your application must have at least 5 users before you can submit it to the Application Directory. We cannot showcase any applications that are under construction or do not utilize the Facebook Platform."
    How to solve this problem. How can i invite users(my friends)
    2. When my facebook friend opens my application ("http://apps.facebook.com/foretee/&quot;), she gets an error as
    "The page you requested was not found.
    You may have clicked an expired link or mistyped the web address (some urls are case sensitive).
    Return home
    Go back to the previous page"
    Please help me out in solving this problem.
    Thanks in advance…

  19. Gayathri,
    I had no problem getting my application added to Facebook. I think you need to check the settings on your application. For more help, I’d suggest posting to the Facebook developers forums.

  20. Hi,
    I will try to devlope a facebook application in asp.net with C#.This is in ifarame.But when i will tring to implement it hall page of facebook is show in canvas.

  21. hi Steve,
    I just downloaded .vsi and am going through the welcome.htm, I noticed that you repeat yourself in the welcom.htm the same information in step 6 as in step 5 ‘Under Installation options’, please let me know if I’m missing something.
    Thanks,

  22. Hi Steve,
    Actually I want only to thank you about your greate effort specially your answers to help others. I really learn alot from you.
    I am also like your smile too ;D
    Thank you,
    Mohammed Elkhodary
    EGYPT

  23. hi again Steve,
    I have a question that I hope you can answer. I’m developing using Facebook.NET, I use Profile.setFBML to show the content on my profile but it doesn’t appear when my friends view my profile, any ideas ?

  24. I just downloaded vsi but when I am trying to run it I get this error:
    “One or more content items contained within the .vscontent file cannot be installed because the correct version of the content installer component cannot be found.
    Contact the author of the content file for information about which installers and versions are required.”
    Any help would be appreciated.

  25. Hi Sergey,
    If you check the last note at the bottom of this post you can see that I updated the Starter Kit to VS.NET 2008. If you’re using 2005 you’ll see this error. You can still get at the files by renaming the .vsi file to .zip and extracting the contents. If I get a chance I’ll look at posting a VS.NET 2005 version but I can’t say I’ll get to that soon.

  26. Hi Steve,
    I followed your steps, but when I run it in the FireFox, it gave me this error:
    The page you requested was not found.
    You may have clicked an expired link or mistyped the address. Some web addresses are case sensitive.
    * Return home
    * Go back to the previous page
    What’s wrong?

  27. Hi Steve,
    I think so too, because I can’t the Site Nav and the Edit URL under the Installation Options.
    What’s wrong? Is my version of the Facebook wrong?

  28. Hi James,
    I don’t know what you’re referring to by "Site Nav" as I don’t see that on the FB app settings page anywhere. The URL you want to focus on is Callback URL, the third item down under "Base Options".
    Good luck!

  29. Hi Steve Trefethen,
    When I use given code snips I am getting these type of error.
    my requirement is, i want to get friend list. Through api nothing else.
    it is very urgent. Please solve this problem as soon as possible.
    Email -dhananjayk1@halosys.com
    Received HTTP error code 500 while loading http://trikonnetworks.com/facebook/Groups.aspx
    There are still a few kinks Facebook and the makers of AdBhai 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!
    ————————CODE——————————-
    Collection<Facebook.Entity.User> f = new Collection<Facebook.Entity.User>();
    f = _fbService.GetFriends();
    GrpDv.InnerHtml = "Have Friends " + f.Count; // GrpDv is a Div with Runut server tag
    ————————CODE——————————-
    With best Regards
    Dhananjay Kumar

  30. Thanks a lot for your work.
    I’m getting the following error when i try to run the application:
    The type or namespace name ‘CanvasIFrameMasterPage’ could not be found (are you missing a using directive or an assembly reference?)
    do you have any idea on how to solve the problem?
    thanks again

  31. Mahdi,
    First, the CanvasIFrameMasterPage is for the Facebook Developer Toolkit not Facebook.NET. Regardless, the error you mention is caused by a missing or out dated assembly reference. Be sure you’re using the v1.7 version of the Facebook Developer Toolkit. I have not updated my Starter Kit for the v2.0 release.

  32. hey steve.
    Can u please help on how to create a facebook desktop application.. i m totally lost man.. wer do i start?? how do i proceed?? see all i know for now is i gotta use facebooknet dlls and then i create my application. wat next?? wer do i host it from?? wats my call back url??
    even in developing i m not able to a auth_token..
    facebook.API ap = new API();
    ap.ApplicationKey = apikey;
    ap.Secret = apisecret;
    auth a = new auth(ap);
    string auth_token = a.createToken();
    // System.Net.HttpWebRequest r = new System.Net.HttpWebRequest();
    facebook.Schema.session_info sess = a.getSession(auth_token);
    on executin the last line i get this exception
    "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."
    I AM TOTALLY Frustrated man..please help me out..

  33. Hi,
    I am experiencing the same problem: "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.". I am willing to help and debug should you give me a clue about what might be happening

  34. Hi,
    I got the same problem with Facebook Developer Toolkit v2.0 (RC2) release. This doesn’t happen with v 1.7 so I guess it’s a bug that will be fixed in final release.
    Alex

  35. Hi Steve
    I downloaded your FaceBook.Net template, i follow your step by step to set-up an application.
    But when i launch it with the Canvas Url it redirect me to the facebook home page
    I dont know why
    Can you help me to start the project ?
    Thx for all, and really good work you do here

  36. hi Steve,
    I’ve created fbml application by referring your article. I’m facing issue is when user is not logged in and opens up app using http://apps.facebook.com/udaw_app/ it gives an error.
    error : You may have clicked an expired link or mistyped the address
    But if user is logged in than it’s working fine and asks.
    Thanks,
    Sandip

  37. Hi Steve,
    I’d created application using facebook toolkit of previous version in asp.net. It has a function FBService.GetFriends(). Previously it was working fine. But recently it was giving an error.
    – Requested value ‘BJP’ was not found
    I don’t want to use latest version of Facebook toolkit. What to do ?
    Thanks,
    Manoj

  38. Steve,
    Solid work on the kit.
    Do you know what the steps would be to integrate the kit into an already existing asp.net application? Reason being is that I would like my FB app to interact with data on my hosted asp.net application.
    I would assume that I would need to add the refs/assemblies, change the web.config, and add the new aspx pages (default, postadd, etc).
    thoughts?
    Thanks,
    SurfZ

  39. Hi Surf,
    Thanks for the comment. I don’t think it would take much work. Review the code in the kit (there’s not much) and you’ll need to apply the changes in the web.config related to the apikey and secret. Also look at the assembly references and add them to your application. That said I haven’t worked with Facebook.NET as it’s well outdated AFAIK. I’ve been putting my focus on the Facebook Developer Toolkit which has just released v2.0 and I’d recommend taking a look at.

  40. I’ve recently just started using your Facebook.NET Starter Kit to develop my web application. I added my own codings in order to make my application work. Previously, I have been using VB.NET to develop my application which is working but now I’ve used the Facebook.NET Starter Kit to integrate my application in facebook. Whenever I run my application through the facebook, it would always need my login username and password and I always got this error message which says (Unable to cast object of type ‘System.Int64’ to type ‘System.String’).
    Your help will be appreciated.
    Thanks.

Comments are closed.