FBCONNECT+Class


 * VB and C# versions for FbConnect Class used in some facebook related wiki pages here.**

=VB= code format="vbnet" Imports Microsoft.VisualBasic

Public Class fbconnect Public Shared ReadOnly Property APIKEY As String Get Return "APIKEY AS STRING HERE"

End Get End Property

Public Shared ReadOnly Property AppSecret As String Get Return "APPSECRET AS STRING HERE" End Get End Property

Public Shared ReadOnly Property SessionID As String Get If HttpContext.Current.Request.Cookies(APIKEY & "_session_key") IsNot Nothing Then Return HttpContext.Current.Request.Cookies(APIKEY & "_session_key").Value End If End Get

End Property

Public Shared ReadOnly Property UID As String Get Dim userid As Integer = -1 Integer.TryParse(HttpContext.Current.Request.Cookies(APIKEY & "_user").Value, userid) Return userid End Get End Property Public Shared Function isAuthenticated As Boolean If Not String.IsNullOrEmpty(SessionID) Then Return True Else Return False End If End Function

End Class

code = = =C#=

code format="csharp" using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics;

public class fbconnect {	public static string APIKEY {

get { return "APIKEY AS STRING HERE"; } }

public static string AppSecret { get { return "APPSECRET AS STRING HERE"; } }

public static string SessionID { get { if (HttpContext.Current.Request.Cookies(APIKEY + "_session_key") != null) { return HttpContext.Current.Request.Cookies(APIKEY + "_session_key").Value; }		}	}

public static string UID { get { int userid = -1; int.TryParse(HttpContext.Current.Request.Cookies(APIKEY + "_user").Value, out userid); return userid; }	}	public static bool isAuthenticated {		if (!string.IsNullOrEmpty(SessionID)) { return true; } else { return false; }	}

}

code