1.2 Doc Example

Jul 20, 2007 at 5:57 AM
I was having trouble setting up the web example shown on the 1.2 documentation. Can you check this to see if I'm doing something wrong? This is what I have...

Imports Facebook
Imports Facebook.WebControls

Partial Public Class _Default
Inherits CanvasFBMLBasePage

Private Const FACEBOOKAPIKEY As String = "YOURAPIKEYHERE" (I know I need to put in my info here)
Private Const FACEBOOK_SECRET As String = "YOURSECRETHERE"

Protected Shadows Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
MyBase.Api = FACEBOOKAPIKEY
MyBase.Secret = FACEBOOK_SECRET
MyBase.Page_Load(sender, e)

If (Not IsPostBack) Then
Dim u As Facebook.Entity.User = Me.FBService.GetUserInfo()
Dim f As Collection(Of Facebook.Entity.User) = Me.FBService.GetFriends()
End If
End Sub
End Class

I have errors wherever there is an underline. I feel like I'm missing something simple...
Jul 20, 2007 at 3:41 PM
You need to include the binaries.

Copy the Facebook.Controls.dll, Facebook,dll, Facebook.WebControls.dll into the bin/ folder in the root directory of your application
Jul 20, 2007 at 7:15 PM
I know this is a stupid question, but I'm a beginner, haha. The name of my project is Facebook so I went to C:\Facebook and added those three binaries but it's still not working. I didn't see an actual bin/folder though. The only things I see in there are Default.aspx.vb, App_Data, Default.aspx, and web.config.
Coordinator
Jul 24, 2007 at 10:00 PM
In your project. Right click and say Add Reference...

Use Browse tab and browse to location of Facebook.dll and Facebook.WebControls.dll.
Jul 28, 2007 at 5:20 PM
thanks
Jul 30, 2007 at 8:41 PM
Few more questions. Does the code I wrote earlier in the post go into the Default.aspx.vb page or can it go anywhere? I'm also getting an error on this part...

Dim f As Collection(Of Facebook.Entity.User) = Me.FBService.GetFriends()

It says that Collection cannot have any parameters. If I remove the "Of Fabeook.Entity.User" part, I get an error saying Value of type System.Collection.ObjectModel.Collection(Of Facebook.Entity.User)' cannot be converted to '1-dimensional array of Microsoft.VisualBasic.Collection'). So I'm not sure what to do.
Jul 30, 2007 at 10:31 PM
Edited Jul 31, 2007 at 12:12 AM
Ack... nevermind, I resolved my problems... the dll are not the latest. Khall7, check if you have the latest dll files, maybe you have old ones and do not support Collection function that has a parameter. Also, try right click on Collection and select resolve, include System.Collections... or something like that.
Jul 31, 2007 at 4:13 AM
I didn't see any new dll files on microsoft's website. I saw where I could download asp.net 2.0 again. Should I try doing that?
Jul 31, 2007 at 8:26 PM
Khall7
Did you try adding import something like System.Collection.ObjectModel?

like import System.Collection.... something something...

Coordinator
Aug 7, 2007 at 3:31 AM
I agree with dknc. This is a "generic" collection that allows the collection to be strongly typed.

In my vb samples I import both
Imports System.Collections.Generic
Imports System.Collections.ObjectModel

But, that collection type is in System.Collection.ObjectModel
Aug 14, 2007 at 2:50 AM
ok, thanks guys
Aug 29, 2007 at 11:14 PM
Edited Aug 29, 2007 at 11:16 PM
I'm also having some trouble getting this example to work. I only started using this example because I had the exact same problem with my own coding. Any asp:textbox or asp:label control will display on the page and the page loads with no errors, but I can't populate the textboxes or labels controls, or even do a simple response.write to output anything to the screen from the code behind page.

Default.aspx
<form id="form1" action="Default2.aspx">
<div>
<asp:Label ID="lblDashboard" runat="server"></asp:Label>
<asp:Label ID="lblHelloWorld" runat="server"></asp:Label><br />
<a href="default2.aspx">Default 2 Link</a>
</div>
<input type="submit" value="default 2 submit" />
</form>

Default.aspx.vb
...
Dim u As Facebook.Entity.User = Me.FBService.GetUserInfo()
Dim f As Collection(Of Facebook.Entity.User) = Me.FBService.GetFriends()

Dim s As String = ""
If f.Count <> 1 Then
s = "s"
End If
lblHelloWorld.Text = "Hello " & u.Name & " you have " & f.Count & " friend" & s & "..." & Me.FBService.SessionKey
Me.FBService.SetFBML("Hello " & u.Name & " you have " & f.Count & " friend" & s)
lblDashboard.Text = "<fb:dashboard><fb:action href=""http://apps.facebook.com/aspnetcanvasfbml/default3.aspx"">Go to Default3</fb:action></fb:dashboard><br/>"


I've omitted some of the code because it's just the basic sample. As you can see lblDashboard should be populated with some FBML (which works if I paste the FBML in the default.aspx page). The code doesn't seem to be doing anything, but it must be working because I have to authenticate, and I'm not getting any errors. It's not just that, I even tried to just write plain text to the label. That's not working either.

Any help would be greatly appreciated.
Coordinator
Sep 12, 2007 at 4:00 AM
You lost me. Can you explain again?
Sep 12, 2007 at 1:52 PM
Long and the short of it is I can display any output to the screen from the shadows page load event. I just tried using the asp.net (vb.net) example as it was delivered. The C# example works fine, and by going ahead with development in C# I've avoided the problem. But this bugs me because I couldn't make it work.