Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            var Request = context.Request;
            oAuthTwitter oAuth = new oAuthTwitter();

             oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);
             if (oAuth.TokenSecret.Length > 0)
             {
                 var username = PageBase.GetCurrentUserSession().Username;
                 Twitter.SaveCredentials(username, oAuth.Token, oAuth.TokenSecret);

                 context.Response.Redirect("Home.aspx");
             }
        }
Example #2
0
        public static void PublishTweet(string username, string tweet)
        {
            using (var db = new AspNetDatingDataContext())
            {
                var credentials = db.TwitterCredentials.FirstOrDefault(tc => tc.u_username == username);
                if (credentials == null) return;

                string url = "";
                string xml = "";
                oAuthTwitter oAuth = new oAuthTwitter();
                oAuth.Token = credentials.tc_username;
                oAuth.TokenSecret = credentials.tc_password;

                //POST
                url = "http://twitter.com/statuses/update.xml";
                xml = oAuth.oAuthWebRequest(oAuthTwitter.Method.POST, url, "status=" + oAuth.UrlEncode(tweet));
            }
        }
Example #3
0
        protected void btnLinkToYourTwitterAccount_Click(object sender, EventArgs e)
        {
            oAuthTwitter oAuth = new oAuthTwitter();

            oAuth.CallBackUrl = Config.Urls.Home.Trim('/') + "/TwitterCallback.ashx";
            Response.Redirect(oAuth.AuthorizationLinkGet());
        }