Author: jgd12345 | Posted on: 6/11/2009 2:29:13 AM | Views : 356

Hi, i wish to have 2 static (so i don't have to create an instance) variables on my global class storing the user id (CurrentUserID) and whether the user is logged in (IsLoggedIn).  Therefore anywhere on my code i can then simply put Global.CurrentUserID to return the current user's id.  So far i have:
public static bool IsLoggedIn
{
    get { return HttpContext.Current.User.Identity.IsAuthenticated; }
}
public static int CurrentUserID
{
    get
    {
        if (HttpContext.Current.Request.Cookies["UserID"] == null && Global.IsLoggedIn)
        {
            // Get the current logged in user
            MembershipUser currentUser = System.Web.Sec ...

Go to the complete details ...