Falling at the first hurdle - Property API is ReadOnly

Jan 20, 2009 at 10:21 AM
Edited Jan 20, 2009 at 10:22 AM
Hi there

I've downloaded the docs and dlls, and followed the instructions for the FBML Canvas Development.

I created a new vb web app in VS 2008, added the 2 dlls, and modified the code behind of default.aspx to:

Imports facebook.Schema
Imports facebook.web

Partial Public Class _Default
    Inherits CanvasFBMLBasePage

    Private Const FACEBOOK_API_KEY As String = "YOURAPIKEYHERE"
    Private Const FACEBOOK_SECRET As String = "YOURSECRETHERE"

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

        If (Not IsPostBack) Then
            ' Use the API client to populate friends
            Dim u As user = Me.API.users.getInfo()
            Dim f As IList(Of user) = Me.API.friends.getUserObjects()
        End If
    End Sub

End Class

There are immediately 2 errors -

Property API is ReadOnly
Page_Load is not a member of facebook.web.CanvasFBMLBasePage

This is not the greatest of starts, so if anyone could help me I would be hugely appreciative

Thanks in advance

Rich

Jan 20, 2009 at 11:16 AM
Update:

I figured out the docs are wrong and it should read:

MyBase

 

.ApiKey = FACEBOOK_API_KEY

So that clears error number 1.

Stll can't call the base load event though.

 

Jan 20, 2009 at 4:30 PM
Hi

If you are using facebook dll's version 2.0 then

Firstly, there is no need to call APIkey and secret key in Every page.
You may add them in Web.Config under <appsettings/>.

Secondly, add
            MyBase.RequireLogin = True
            MyBase.Page_Init(sender, e)  in page load. Then u can access the page in facebook

Hope this helps you..
Jan 20, 2009 at 5:08 PM
Amazing, thank you so much!

Rich