How do I implement infinite sessions?

Apr 22, 2009 at 11:20 PM
I've tried doing exactly as the documentation says, here is my code for logging in, it should also setup infinite sessions for all users after their initial log in.
In the code below references to this.fb and fb are the same object, it is a reference to an instance of FacebookService.  I'm surprised there isn't more documentation on how to get infinite sessions.
And just in case it is relevant here are some more facts about the app, it is .net 3.5, the GUI is done in XAML, the operating system is Vista Home Premium (the app is for vista only because of voice recognition requirements).
public void LoginToFacebookService() {
this.fb.IsDesktopApplication = true;
this.fb.ApplicationKey = "OMITTED";//Omitted for posting to codeplex for obvious reasons
this.fb.Secret = "OMITTED"; //Omitted for obvious reasons
Configuration config = ConfigurationManager.OpenExeConfiguration( System.Windows.Forms.Application.ExecutablePath );
if( config.AppSettings.Settings["fb_user_id"] != null &&
config.AppSettings.Settings["fb_secret"] != null &&
config.AppSettings.Settings["fb_session_key"] != null )
try {
KeyValueConfigurationCollection settings = config.AppSettings.Settings;
fb.uid = long.Parse( settings["fb_user_id"].Value );
fb.Secret = settings["fb_secret"].Value;
fb.SessionKey = settings["fb_session_key"].Value;
fb.ConnectToFacebook(); //if this fails
catch {
ManualFacebookLogin( config );
ManualFacebookLogin( config ); //try this if there is no such section in the app.config
//...(ellipsis, if you don't know what it means look it up)...There is mor

private void ManualFacebookLogin(Configuration config)
//reset the values so the dialog box will be shown
this.fb.ApplicationKey = "OMITTED";
this.fb.Secret = "OMITTED";
this.fb.SessionKey = null; //will set later after log in
this.fb.uid = ((long)(0)); //will set later after log in

fb.ConnectToFacebook(); //just should have to do this once
if( !fb.SessionExpires ) { //save their info so they won't have to log in ever again...
config.AppSettings.Settings.Add( "fb_user_id", fb.uid.ToString() );
config.AppSettings.Settings.Add( "fb_secret", fb.Secret );
config.AppSettings.Settings.Add( "fb_session_key", fb.SessionKey );