asp.net mvc - Updating Twitter status using LinqToTwitter -
here's set out do:
- make mvc app on user clicks button , taken twitter login page
- after giving credentials user redirected second page
- on secong page there text box , 'tweet' button
- entering message , clicking on 'tweet' update status
i got till 2nd point following samples linqtotwitter codeplex page.
the code oauth controller works fine , redirect mvc app's second page.
but missing not posting status.
this code in button click pass user entered status:
public actionresult status(string status) { var auth = new mvcauthorizer { credentialstore = new sessionstatecredentialstore() }; auth.completeauthorizeasync(request.url); var twittercontext = new twittercontext(auth); tweetasync(twittercontext, status); return view(); //return view user } void tweetasync(twittercontext twitterctx, string statustoupdate) { var tweet = twitterctx.tweetasync(statustoupdate); if (tweet != null) { // inform user success } }
both above methods in oauth controller.
can please me this?
thanks in advance.
change method use async , return task:
public async task status(string status) { //...
var tweet = await twittercontext.tweetasync(twittercontext, status); // ... }
and await tweetasync, assigning response status entity named tweet. if want separate method calling tweetasync, make async also. async, must make every method in call chain async.
Comments
Post a Comment