asp.net (vb) errorcode 500

Aug 9, 2009 at 11:45 AM

Hello all,

I'm trying to figure out how to use the Facebook Developer Toolkit, i have followed some tutorials on but i can't get it to work.

I get this error message:

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

 Line 3:      <form runat="server">
Line 4:      <div>
Line 5:      Hello, <%= API.users.getInfo().name %>
Line 6:      </div>
Line 7:      </form>

When i access it from facebook i just get a http 500 error code without details.

I have done the following:

  1. Added the 4 dlls as referances in my project
  2. Added FriendList, PhotoAlbum etc to the visual studio toolbox
  3. Added the settings to web.config

My VB code is:

Partial Public Class _Default

    Inherits facebook.web.CanvasFBMLBasePage
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      
Me.RequireLogin = True
   
End Sub

End Class

My HTML code is:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %>

     <form id="form1" runat="server">
    <div>
    Hello, <%= API.users.getInfo().name %>
    </div>
    </form>

 

Can anyone give me a hint on what im doing wrong?

Aug 9, 2009 at 1:04 PM

I figured my mistake, was using the wrong event to trigger requerelogin.

 

 

 

 

Partial

 

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

 

</font></font><font size="2" color="#0000ff">

 

</font>

 

Public Class _Default'Inherits System.Web.UI.Page

<font size="2">

 

</font>

 

Inherits facebook.web.CanvasFBMLBasePageProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Me.RequireLogin = True

End Sub

<font size="2">

 

</font>

Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit

MyBase.RequireLogin = True <font size="2">

 

</font>

End Sub

End Class