protected void Page_PreRender(Object o, EventArgs e) { using (Database db = new MySqlDatabase()) { ClientInfo ci = db.GetClientInfo(Util.UserId); bool isNotExpired = true; Facebook.AuthenticationService authService = new Facebook.AuthenticationService(); Facebook.Me me; string accessToken = string.Empty; if (authService.TryAuthenticate(out me, out accessToken)) { isNotExpired = true; } else { db.RemoveSocialCredential(ci.ClientId, SocialConnector.Facebook); db.UpdateFacebookID(ci.ClientId); isNotExpired = false; } if (!string.IsNullOrEmpty(ci.SoundCloudId)) SoundcloudItag.Attributes.Add("class", "soundcloud"); else SoundcloudItag.Attributes.Add("class", "soundcloud disabled"); if (isNotExpired) FacebookHeading.Attributes.Add("class", "social facebook"); else FacebookHeading.Attributes.Add("class", "social facebook disabled"); if (!string.IsNullOrEmpty(ci.TwitterId)) TwitterHeading.Attributes.Add("class", "social twitter"); else TwitterHeading.Attributes.Add("class", "social twitter disabled"); } }