protected void btnIndividualLogout_Click(object sender, CommandEventArgs e) { PROVIDER_TYPE provider = (PROVIDER_TYPE)Enum.Parse(typeof(PROVIDER_TYPE), e.CommandArgument.ToString()); SocialAuthUser.GetCurrentUser().Logout(providerType: provider); Response.Redirect(HttpContext.Current.Request.Url.ToString()); }
protected void Page_Load(object sender, EventArgs e) { SocialAuthUser.GetConnectedProviders().ForEach(x => { ddlConnectedProviders.Items.Add(new ListItem(x.ToString())); }); }
protected void btnCustomFeed_Click(object sender, EventArgs e) { if (SocialAuthUser.IsConnectedWith(PROVIDER_TYPE.FACEBOOK)) { WebResponse wr = SocialAuthUser.GetCurrentUser().ExecuteFeed("https://graph.facebook.com/me/albums", TRANSPORT_METHOD.GET, PROVIDER_TYPE.FACEBOOK); StreamReader reader = new StreamReader(wr.GetResponseStream()); string albumJson = reader.ReadToEnd(); JObject jsonObject = JObject.Parse(albumJson); List <Album> albums = new List <Album>(); jsonObject["data"].Children().ToList().ForEach(x => { albums.Add(new Album() { ID = (string)x["id"], PhotoCount = x["count"] == null ? 0 : Convert.ToInt32(x["count"].ToString().Replace("\"", "")), Name = (string)x["name"].ToString().Replace("\"", ""), Location = (string)x["location"] == null ? "" : x["location"].ToString().Replace("\"", ""), CoverPhoto = (string)x["cover_photo"] == null ? "" : x["cover_photo"].ToString().Replace("\"", "") }); }); foreach (var item in albums) { Label lbl = new Label(); lbl.Text = "<h3>" + item.Name + "</h3>(" + item.PhotoCount + ") : " + "<img src='https://graph.facebook.com/" + item.CoverPhoto + "/picture?type=album&access_token=" + SocialAuthUser.GetCurrentUser().GetAccessToken() + "'>"; lbl.CssClass = "album"; lblAlbum.Controls.Add(lbl); } lblJson.Text = "Executed custom feed: <b>https://graph.facebook.com/me/albums</b><br>Result:<br>" + albumJson; } }
private HtmlGenericControl constructControl(IProvider provider) { string iconPath = Utility.GetSocialAuthConfiguration().IconFolder.Path + provider.ProviderType.ToString() + ".png"; bool isconnected = SocialAuthUser.IsConnectedWith(provider.ProviderType); bool iscurrent = (SocialAuthUser.CurrentProvider == provider.ProviderType); HtmlGenericControl providerDiv = new HtmlGenericControl("div"); providerDiv.Attributes.Add("class", "provider"); ImageButton imgB = new ImageButton() { ID = "img" + provider.ProviderType, CommandArgument = provider.ProviderType.ToString(), ImageUrl = iconPath }; if (isconnected) { HtmlGenericControl tickspan = new HtmlGenericControl("span"); tickspan.InnerHtml = "<img src='images/socialauthicons/" + (iscurrent ? "currentyes" : "yes") + ".png' style='top:0px;left:0px;z-index:100'/>"; tickspan.Style.Add("position", "absolute"); providerDiv.Controls.Add(tickspan); } //if (iscurrent) // imgB.Style.Add("border", "1px solid yellow"); imgB.Command += new CommandEventHandler(imgB_Command); providerDiv.Controls.Add(imgB); return(providerDiv); }
protected void Page_Load(object sender, EventArgs e) { if (SocialAuthUser.IsLoggedIn()) { lbtnLogout.Visible = true; } }
protected void btnDownload_Click(object sender, EventArgs e) { if (ddlConnectedProviders.Items.Count == 0) { ScriptManager.RegisterClientScriptBlock(this.Page, typeof(Page), "noprovider", "alert('You are not connected with any provider')", true); return; } var token = SocialAuthUser.GetCurrentUser().GetConnection((PROVIDER_TYPE)Enum.Parse(typeof(PROVIDER_TYPE), ddlConnectedProviders.SelectedItem.Value)).GetConnectionToken(); IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(Server.MapPath("~/temptokens/MyFile.token"), FileMode.Create, FileAccess.Write, FileShare.Write); formatter.Serialize(stream, token); stream.Close(); stream.Dispose(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}", "MyFile.token")); Response.WriteFile("~/temptokens/MyFile.token"); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (!SocialAuthUser.IsConnectedWith(PROVIDER_TYPE.FACEBOOK)) { lblAlbum.Text = "You need to login with Facebook to view this demo!"; btnCustomFeed.Visible = false; } }
protected void btnUpload_Click(object sender, EventArgs e) { SocialAuthUser sauser = new SocialAuthUser(); MemoryStream ms = new MemoryStream(FileUpload1.FileBytes); IFormatter formatter = new BinaryFormatter(); Token token = (Token)formatter.Deserialize(ms); sauser.LoadToken(token, "default.aspx"); }
public static string IsUserLoggedIn() { try { return(SocialAuthUser.IsLoggedIn().ToString()); } catch { return("error"); } }
public static string GetProvider(this IIdentity identity) { if (SocialAuthUser.IsLoggedIn() && Brickred.SocialAuth.NET.Core.Utility.GetSocialAuthConfiguration().Authentication.AllowModificationToUserIdentity) { return(SocialAuthUser.CurrentConnection.ProviderType.ToString()); } else { return(""); } }
public static List <Brickred.SocialAuth.NET.Core.BusinessObjects.Contact> GetContacts(this IIdentity identity) { if (SocialAuthUser.IsLoggedIn() && Brickred.SocialAuth.NET.Core.Utility.GetSocialAuthConfiguration().Authentication.AllowModificationToUserIdentity) { return(SocialAuthUser.GetCurrentUser().GetContacts()); } else { return(null); } }
/// <summary> /// Post /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bntPost_Click(object sender, EventArgs args) { pgbPost.Value = 0; pgbPost.Maximum = ds_media.Tables[0].Rows.Count; for (int idx = 0; idx < ds_media.Tables[0].Rows.Count; idx++) { String mediaPublishId = ds_media.Tables[0].Rows[idx]["发布编号"].ToString(); setMediaPublishStatus(mediaPublishId, "发行中"); string content = ds_media.Tables[0].Rows[CurrentIndex - 1]["名称"].ToString() + ds_media.Tables[0].Rows[CurrentIndex - 1]["发行期号"].ToString() + "[" + ds_media.Tables[0].Rows[CurrentIndex - 1]["发行日期"].ToString() + "]\r\n" + ds_media.Tables[0].Rows[CurrentIndex - 1]["文本内容"].ToString(); string picpath = ds_media.Tables[0].Rows[CurrentIndex - 1]["本地图片"].ToString(); try { string msg = HttpUtility.UrlEncode(content); string endpoint = null; switch (provider_type) { case PROVIDER_TYPE.FACEBOOK: endpoint = "https://graph.facebook.com/me/feed?message=" + msg + "&access_token=" + SocialAuthUser.GetCurrentUser().GetConnection(PROVIDER_TYPE.FACEBOOK).GetConnectionToken().AccessToken; break; case PROVIDER_TYPE.TWITTER: endpoint = "http://api.twitter.com/1.1/statuses/update.json?status=" + msg; break; } string body = String.Empty; //byte[] reqbytes = new ASCIIEncoding().GetBytes(body); byte[] reqbytes = File.ReadAllBytes(ds_media.Tables[0].Rows[idx]["本地图片"].ToString()); Dictionary <string, string> headers = new Dictionary <string, string>(); //headers.Add("contentType", "application/x-www-form-urlencoded"); headers.Add("contentType", "image/jpeg"); headers.Add("FileName", Path.GetFileName(ds_media.Tables[0].Rows[idx]["本地图片"].ToString())); var response = manager.ExecuteFeed( endpoint, TRANSPORT_METHOD.POST, provider_type, reqbytes, headers ); setMediaPublishStatus(mediaPublishId, "发行完"); } catch (Exception ex) { setMediaPublishStatus(mediaPublishId, "未发行"); NCLogger.GetInstance().WriteExceptionLog(ex); } } }
protected void btn_Click(object sender, EventArgs e) { //We need to get user's selected provider enumerator. PROVIDER_TYPE selectedProvider = (PROVIDER_TYPE)Enum.Parse(typeof(PROVIDER_TYPE), ((Button)sender).Text.ToUpper()); //Initialize User SocialAuthUser objUser = new SocialAuthUser(selectedProvider); //Call Login objUser.Login(returnUrl: "ManualLogin.aspx"); //Login method also accepts a parameter for URL to which user should be redirected after login. If not specified, //automatically defaultUrl as set in Web.Config will be picked for redirection. }
public void DirectUserToServiceProvider() { string loginUrl = GetLoginUrl(ConnectionToken.ProviderCallbackUrl); try { logger.Debug("Redirecting user for login to " + loginUrl); SocialAuthUser.Redirect(loginUrl); } catch (Exception ex) { logger.Error(ErrorMessages.UserLoginRedirectionError(loginUrl), ex); } }
protected void Page_Load(object sender, EventArgs e) { if (!SocialAuthUser.IsConnectedWith(PROVIDER_TYPE.FACEBOOK)) { btnPOST.Enabled = false; btnGET.Enabled = false; errLabel.Text = "You need to be logged into Facebook to try this demo!"; errLabel.ForeColor = System.Drawing.Color.Red; } else { GetUpdates(); } }
//****** OPERATIONS public override UserProfile GetProfile() { Token token = SocialAuthUser.GetCurrentUser().GetConnection(this.ProviderType).GetConnectionToken(); UserProfile profile = new UserProfile(ProviderType); string response = ""; //If token already has profile for this provider, we can return it to avoid a call if (token.Profile.IsSet) { logger.Debug("Profile successfully returned from session"); return(token.Profile); } try { logger.Debug("Executing Profile feed"); string profileUrl = ProfileEndpoint + "?user_id=" + token.Profile.ID; Stream responseStream = AuthenticationStrategy.ExecuteFeed(profileUrl, this, token, TRANSPORT_METHOD.GET).GetResponseStream(); response = new StreamReader(responseStream).ReadToEnd(); } catch { throw; } try { JObject profileJson = JObject.Parse(response); profile.ID = profileJson.Get("id_str"); profile.FirstName = profileJson.Get("name"); profile.Country = profileJson.Get("location"); profile.DisplayName = profileJson.Get("screen_name"); //profile.Email = not provided profile.Language = profileJson.Get("lang"); profile.ProfilePictureURL = profileJson.Get("profile_image_url"); profile.IsSet = true; token.Profile = profile; logger.Info("Profile successfully received"); } catch (Exception ex) { logger.Error(ErrorMessages.ProfileParsingError(response), ex); throw new DataParsingException(ErrorMessages.ProfileParsingError(response), ex); } return(profile); }
protected void btnPOST_Click(object sender, EventArgs e) { string msg = HttpUtility.UrlEncode(txtStatus.Text); string endpoint = "https://graph.facebook.com/me/feed?message=" + msg + "&access_token=" + SocialAuthUser.GetCurrentUser().GetConnection(PROVIDER_TYPE.FACEBOOK).GetConnectionToken().AccessToken; string body = String.Empty; byte[] reqbytes = new ASCIIEncoding().GetBytes(body); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("contentType", "application/x-www-form-urlencoded"); var response = SocialAuthUser.GetCurrentUser().ExecuteFeed( endpoint, TRANSPORT_METHOD.POST, PROVIDER_TYPE.FACEBOOK, reqbytes, headers ); errLabel.ForeColor = System.Drawing.Color.Purple; errLabel.Text = "Post successfully posted! Please refresh updates list to confirm or check on Facebook!!"; }
protected void btnPOST_Click(object sender, EventArgs e) { string msg = HttpUtility.UrlEncode(txtTweet.Text); string endpoint = "http://api.twitter.com/1.1/statuses/update.json?status=" + msg; string body = String.Empty; byte[] reqbytes = new ASCIIEncoding().GetBytes(body); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("contentType", "application/x-www-form-urlencoded"); var response = SocialAuthUser.GetCurrentUser().ExecuteFeed( endpoint, TRANSPORT_METHOD.POST, PROVIDER_TYPE.TWITTER, reqbytes, headers ); errLabel.ForeColor = System.Drawing.Color.Purple; errLabel.Text = "Post successfully posted! Please refresh tweets list to confirm or check on Twitter!!"; }
/// <summary> /// This method returns the claims to be issued in the token. /// </summary> /// <param name="principal">The caller's principal.</param> /// <param name="request">The incoming RST, can be used to obtain addtional information.</param> /// <param name="scope">The scope information corresponding to this request.</param> /// <exception cref="ArgumentNullException">If 'principal' parameter is null.</exception> /// <returns>The outgoing claimsIdentity to be included in the issued token.</returns> protected override IClaimsIdentity GetOutputClaimsIdentity(IClaimsPrincipal principal, RequestSecurityToken request, Scope scope) { if (null == principal) { throw new ArgumentNullException("principal"); } ClaimsIdentity outputIdentity = new ClaimsIdentity(); // Issue custom claims. // TODO: Change the claims below to issue custom claims // that are required by your application. // Update the application's configuration file to reflect // the new claims requirements. // outputIdentity.Claims.Add( new Claim(System.IdentityModel.Claims.ClaimTypes.Name, principal.Identity.Name ) ); // outputIdentity.Claims.Add( new Claim( ClaimTypes.Role, "Manager" ) ); // The Wingtip implementation. string username = principal.Identity.Name; List <Claim> claims = new List <Claim>(); if (SocialAuthUser.IsLoggedIn()) { claims = UserInfo.GetClaimsForSocialAuthUser(SocialAuthUser.GetCurrentUser().GetProfile()); } else { claims = UserInfo.GetClaimsForUser(username); } foreach (Claim claim in claims) { outputIdentity.Claims.Add(claim); } return(outputIdentity); }
private void GetTweets() { var response = SocialAuthUser.GetCurrentUser().ExecuteFeed("https://api.twitter.com/1.1/statuses/home_timeline.json?include_entities=true", TRANSPORT_METHOD.GET, PROVIDER_TYPE.TWITTER); var tweetsJson = new StreamReader(response.GetResponseStream()).ReadToEnd(); var tweets = JArray.Parse(tweetsJson); var i = 0; foreach (var tweet in tweets) { HtmlGenericControl newdiv = new HtmlGenericControl("div"); newdiv.Style.Add("clear", "both"); newdiv.Style.Add("margin-top", "5px;"); newdiv.Style.Add("background-color", i % 2 == 0 ? "#CCFF66" : "#FFF999"); newdiv.Style.Add("height", "100%"); newdiv.InnerHtml = "<span style='float:left'><img src=" + tweet.SelectToken("user.profile_image_url_https") + " /></span>"; newdiv.InnerHtml += "<span><b>" + tweet.SelectToken("user.name") + "</b> says:<br>" + tweet.SelectToken("text") + "</span>"; divTweets.Controls.Add(newdiv); if (++i == 10) { break; } } }
public void ProcessRequest(HttpContext context) { //Call for Logout if (current.Request.Url.ToString().IndexOf("logout.sauth") > -1) { SocialAuthUser.Disconnect(); } //Call for login (likely from HTML clients) with provider in parameter "p" else if (HttpContext.Current.Request.RawUrl.ToLower().Contains("login.sauth")) { string returnUrl = ""; if (current.Request["returnUrl"] != null) { returnUrl = current.Request["returnUrl"]; } if (current.Request["p"] != null) { SocialAuthUser.Connect((PROVIDER_TYPE)Enum.Parse(typeof(PROVIDER_TYPE), HttpContext.Current.Request["p"].ToUpper()), returnURL: returnUrl); } } //call to display login Form else if (HttpContext.Current.Request.RawUrl.ToLower().Contains("loginform.sauth")) { RenderHtml(); HttpContext.Current.Response.End(); } //call to process response received from Providers else if (HttpContext.Current.Request.RawUrl.ToLower().Contains("validate.sauth")) { SocialAuthUser.LoginCallback(HttpContext.Current.Request.Url.ToString()); } }
private void GetUpdates() { var response = SocialAuthUser.GetCurrentUser().ExecuteFeed("https://graph.facebook.com/me/feed?access_token=" + SocialAuthUser.GetCurrentUser().GetAccessToken(), TRANSPORT_METHOD.GET, PROVIDER_TYPE.FACEBOOK); var updatesJson = new StreamReader(response.GetResponseStream()).ReadToEnd(); var data = JObject.Parse(updatesJson); var updates = JArray.Parse(data.SelectToken("data").ToString()); var i = 0; foreach (var tweet in updates) { HtmlGenericControl newdiv = new HtmlGenericControl("div"); newdiv.Style.Add("clear", "both"); newdiv.Style.Add("margin-top", "5px;"); newdiv.Style.Add("background-color", i % 2 == 0 ? "#CCFF66" : "#FFF999"); newdiv.Style.Add("height", "100%"); //newdiv.InnerHtml = "<span style='float:left'><img src=" + tweet.SelectToken("user.profile_image_url_https") + " /></span>"; newdiv.InnerHtml += "<span><b>" + tweet.SelectToken("from.name") + "</b> says:<br>" + tweet.SelectToken("message") + "</span>"; divUpdates.Controls.Add(newdiv); if (++i == 10) { break; } } }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString["provider"] != null) { PROVIDER_TYPE providerType = (PROVIDER_TYPE)Enum.Parse(typeof(PROVIDER_TYPE), Request.QueryString["provider"].ToUpper()); SocialAuthUser.GetCurrentUser().Login(providerType, "popupprocess.aspx", errorRedirectURL: "popupprocess.aspx"); ClientScript.RegisterClientScriptBlock(this.GetType(), "closeWin", "<script>window.close()</script>"); } else if (Request.QueryString["error_message"] != null) { ClientScript.RegisterStartupScript(this.GetType(), "closeWin", "<script>alert('" + Request.QueryString["error_message"] + "'); window.close()</script>"); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "closeWin", "<script>window.close()</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "closeWin", "<script>window.close()</script>"); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString["provider"] != null) { PROVIDER_TYPE providerType = (PROVIDER_TYPE)Enum.Parse(typeof(PROVIDER_TYPE), Request.QueryString["provider"].ToUpper()); SocialAuthUser.GetCurrentUser().Login(providerType, "Pages/ProcessPopup.aspx", errorRedirectURL: "Pages/ProcessPopup.aspx"); ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "closeWindow", "closeWindow();", true); } else if (Request.QueryString["error_message"] != null) { ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "closeWindow", "showErrorMsg('An error has occured');", true); } else { ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "closeWindow", "closeWindow();", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "closeWindow", "closeWindow();", true); } }
protected void lbtnLogout_Click(object sender, EventArgs e) { SocialAuthUser.GetCurrentUser().Logout("Default.aspx"); lbtnLogout.Visible = false; }
// // GET: /Account/LogOff public ActionResult LogOff() { FormsAuthentication.SignOut(); SocialAuthUser.GetCurrentUser().Logout(); return(RedirectToAction("Index", "Home")); }
/// <summary> /// Performs WS-Federation Passive Protocol processing. /// </summary> protected void Page_PreRender(object sender, EventArgs e) { string action = Request.QueryString[WSFederationConstants.Parameters.Action]; try { if (action == WSFederationConstants.Actions.SignIn) { // Process signin request. SignInRequestMessage requestMessage = (SignInRequestMessage)WSFederationMessage.CreateFromUri(Request.Url); if (User != null && User.Identity != null && User.Identity.IsAuthenticated) { SecurityTokenService sts = new CustomSecurityTokenService(CustomSecurityTokenServiceConfiguration.Current); SignInResponseMessage responseMessage = FederatedPassiveSecurityTokenServiceOperations.ProcessSignInRequest(requestMessage, User, sts); FederatedPassiveSecurityTokenServiceOperations.ProcessSignInResponse(responseMessage, Response); } else { throw new UnauthorizedAccessException(); } } else if (action == WSFederationConstants.Actions.SignOut) { // Process signout request. SignOutRequestMessage requestMessage = (SignOutRequestMessage)WSFederationMessage.CreateFromUri(Request.Url); FederatedPassiveSecurityTokenServiceOperations.ProcessSignOutRequest(requestMessage, User, requestMessage.Reply, Response); } else if (action == null && SocialAuthUser.IsLoggedIn()) { string originalUrl = SocialAuthUser.GetCurrentUser().GetConnection(SocialAuthUser.CurrentProvider).GetConnectionToken().UserReturnURL; //replace ru value int wctxBeginsFrom = originalUrl.IndexOf("wctx="); int wctxEndsAt = originalUrl.IndexOf("&wct="); string wctxContent = originalUrl.Substring(wctxBeginsFrom + 5, wctxEndsAt - (wctxBeginsFrom + 5)); originalUrl = originalUrl.Replace(wctxContent, Server.UrlEncode(wctxContent)); //replace wtrealm value int wtrealmBeginsFrom = originalUrl.IndexOf("wtrealm="); int wtrealmEndsAt = originalUrl.IndexOf("&", wtrealmBeginsFrom); string wtrealmContent = originalUrl.Substring(wtrealmBeginsFrom + 8, wtrealmEndsAt - (wtrealmBeginsFrom + 8)); originalUrl = originalUrl.Replace(wtrealmContent, Server.UrlEncode(wtrealmContent)); SignInRequestMessage requestMessage = (SignInRequestMessage)WSFederationMessage.CreateFromUri(new Uri(originalUrl)); if (User != null && User.Identity != null && User.Identity.IsAuthenticated) { SecurityTokenService sts = new CustomSecurityTokenService(CustomSecurityTokenServiceConfiguration.Current); SignInResponseMessage responseMessage = FederatedPassiveSecurityTokenServiceOperations.ProcessSignInRequest(requestMessage, User, sts); FederatedPassiveSecurityTokenServiceOperations.ProcessSignInResponse(responseMessage, Response); } } else { throw new InvalidOperationException( String.Format(CultureInfo.InvariantCulture, "The action '{0}' (Request.QueryString['{1}']) is unexpected. Expected actions are: '{2}' or '{3}'.", String.IsNullOrEmpty(action) ? "<EMPTY>" : action, WSFederationConstants.Parameters.Action, WSFederationConstants.Actions.SignIn, WSFederationConstants.Actions.SignOut)); } } catch (Exception exception) { throw new Exception("An unexpected error occurred when processing the request. See inner exception for details.", exception); } }
protected void btnLogout_Click(object sender, EventArgs e) { SocialAuthUser.GetCurrentUser().Logout("ManualLogin.aspx"); }
private void imgB_Command(object sender, EventArgs e) { SocialAuthUser.GetCurrentUser().Login((PROVIDER_TYPE)Enum.Parse(typeof(PROVIDER_TYPE), ((CommandEventArgs)e).CommandArgument.ToString()), DefaultURL); }
protected void Page_Load(object sender, EventArgs e) { //Required to be done when using custom mode //if (!SocialAuthUser.IsLoggedIn()) // SocialAuthUser.RedirectToLoginPage("ManualLogin.aspx"); foreach (PROVIDER_TYPE p in SocialAuthUser.GetConnectedProviders()) { divConnections.Controls.Add(new Literal() { Text = "<br>Connected to: <b>" + p.ToString() + "</b> with identifier <b>" + SocialAuthUser.GetCurrentUser().GetProfile(p).GetIdentifier() + "</b>" }); LinkButton logoutBtn = new LinkButton() { Text = "[Logout from " + p.ToString() + "]", CommandArgument = p.ToString() }; logoutBtn.Command += new CommandEventHandler(btnIndividualLogout_Click); divConnections.Controls.Add(logoutBtn); } if (SocialAuthUser.IsLoggedIn()) { IsSTSaware = HttpContext.Current.ApplicationInstance.IsSTSaware(); Provider = User.Identity.GetProvider(); Pid = User.Identity.GetProfile().ID; Identifier = User.Identity.GetProfile().GetIdentifier(); Username = User.Identity.GetProfile().Username; Displayname = User.Identity.GetProfile().DisplayName; Email = User.Identity.GetProfile().Email; Fullname = User.Identity.GetProfile().FullName; FirstName = User.Identity.GetProfile().FirstName; LastName = User.Identity.GetProfile().LastName; DateOfBirth = User.Identity.GetProfile().DateOfBirth; Gender = User.Identity.GetProfile().Gender.ToString(); ProfileURL = User.Identity.GetProfile().ProfileURL; ProfilePicture = User.Identity.GetProfile().ProfilePictureURL; Country = User.Identity.GetProfile().Country; Language = User.Identity.GetProfile().Language; AccessToken = SocialAuthUser.GetCurrentUser().GetAccessToken(); bool IsAlternate = false; try { User.Identity.GetContacts().ForEach( x => { HtmlTableRow tr = new HtmlTableRow(); tr.Attributes.Add("class", (IsAlternate) ? "dark" : "light"); tr.Cells.Add(new HtmlTableCell() { InnerText = x.Name }); tr.Cells.Add(new HtmlTableCell() { InnerText = x.Email }); tr.Cells.Add(new HtmlTableCell() { InnerText = x.ProfileURL }); tblContacts.Rows.Add(tr); IsAlternate = !IsAlternate; } ); ContactsCount = (tblContacts.Rows.Count - 1).ToString(); } catch (Exception ex) { contacts.InnerHtml = "<error>" + ex.Message + "</error>"; } } else { Response.Write("You are not logged in.."); } }