Console Application .. what is wrong?

Feb 5, 2010 at 1:52 PM

I have this simple :


 Facebook.Session.ConnectSession connectsession = new Facebook.Session.ConnectSession("b5e6c7f3e9e6f859605e8c494004bc93", "539e8cc447e67e2bf4fc4fbe190a976d");
            Facebook.Rest.Api api = new Facebook.Rest.Api((Facebook.Session.FacebookSession)connectsession);

 Facebook.Session.ConnectSession connectsession = new Facebook.Session.ConnectSession("xxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxx");

Facebook.Rest.Api api = new Facebook.Rest.Api((Facebook.Session.FacebookSession)connectsession);

 api.Notifications.Send("uid_number", "TestNotification");
but it gets an error wanting a Session to create.How do i create a session so to overcome this and send notifications or post to a wall (if the user id has given me the permission to post offcourse) ??????????????


Feb 7, 2010 at 12:46 AM

For you to be able to post you will need an active session OR you will need to have created an infinate session.  The infinate session will allow you to post to the facebook page when they are not logged into your application look at (offline_access). 

SO, if you would like to make a post after you have logged into your facebook connect page you should add a login button like this to you web page.  Once you have logged in you will be able to run functions with the API.

Button to add...


    <script src="" type="text/javascript"></script>
    <script type="text/javascript">
        FB.init("Your API", "/xd_receiver.htm");
    <fb:login-button onlogin="window.location.reload()"></fb:login-button>

Code After...

private Api _facebookAPI;
private ConnectSession _connectSession = new ConnectSession("Your API Key", "Secret");

_facebookAPI = new Api(_connectSession);

user user = _facebookAPI.Users.GetInfo();
Feb 8, 2010 at 8:28 AM

TGRANT thanx for your help.

but trying to put this i get :

FBML Error (line 82): illegal event "onlogin" in tag "fb:custom-tag"
FBML Error (line 82): unknown tag "fb:login-button"

Can I post to someone else's wall , if he/she has accepted from app to post in a profile??? I want to make a simple application that runs every once in a week and posts to 1 or 2 people i have from my app's users who have granted me permission to do this.

How do i create an infinate session in a console application ? I have only post to someone else's wall from a Session I have stored in my web and copy pasted in the console app.

If i Use the :

private ConnectSession _connectSession = new ConnectSession("Your API Key", "Secret");
it creates a connectSession with NULL sessionKey !!!

Thanx for all the help