コード例 #1
0
 protected void lnkAuthorizeGooglePlus_Click(object sender, EventArgs e)
 {
     try
     {
         SocialNetworkAuthorization.PushRedirect(Request.Url.PathAndQuery);
         Response.Redirect(mfbGooglePlus1.AuthURL.ToString());
     }
     catch (MyFlightbookException ex)
     {
         lblSocNetworkPrefsUpdated.Text     = ex.Message;
         lblSocNetworkPrefsUpdated.CssClass = "error";
     }
 }
コード例 #2
0
    /// <summary>
    /// Post the flight to Twitter
    /// </summary>
    /// <param name="le">The logbook entry being posted</param>
    /// <returns>true for success</returns>
    public Boolean PostFlight(LogbookEntry le)
    {
        if (le == null)
        {
            throw new ArgumentNullException("le");
        }
        Boolean fResult = false;

        oAuthTwitter oAuth = new oAuthTwitter();

        GetUserTwitterToken(le.User, oAuth);

        if (oAuth.Token.Length == 0 && Request["oauth_token"] == null)
        {
            PendingFlightToPost = le;  // hold on to this logbook entry for post-authorization...

            //Redirect the user to Twitter for authorization.
            oAuth.CallBackUrl = "~/member/PostFlight.aspx".ToAbsoluteURL(Request).ToString();
            SocialNetworkAuthorization.PushRedirect(oAuth.AuthorizationLinkGet());
        }
        else
        {
            if (oAuth.TokenSecret.Length == 0)
            {
                oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);
                SetUserTwitterToken(Page.User.Identity.Name, oAuth);
            }

            if (new TwitterPoster().PostToSocialMedia(le, Page.User.Identity.Name, Request.Url.Host))
            {
                FDefaultTwitterCheckboxState = true;
                fResult = true;
            }
        }
        return(fResult);
    }
コード例 #3
0
 protected void lnkSetUpFacebook_Click(object sender, EventArgs e)
 {
     SocialNetworkAuthorization.PushRedirect(Request.Url.PathAndQuery);
     MFBFacebook.Authorize();
 }
コード例 #4
0
 protected void lnkSetUpTwitter_Click(object sender, EventArgs e)
 {
     SocialNetworkAuthorization.PushRedirect(Request.Url.PathAndQuery);
     Response.Redirect(mfbTwitter.AuthURL.ToString());
 }