This project has moved and is read-only. For the latest updates, please go here.

Linqtotwitter Update Account Image problem

Jul 14, 2011 at 8:29 AM
Edited Jul 14, 2011 at 1:55 PM

I have use LinqtoTwitter api in my application. i want to update user profile image without that again asking for permission which i have taken accesstoken and oAuthToken info before. Here is my code and received error message;   Thanks a lot ..


IOAuthCredentials credentials = new SessionStateCredentials();

private MvcAuthorizer auth;
private TwitterContext twitterCtx;

if (credentials.ConsumerKey == null || credentials.ConsumerSecret == null)


                   credentials.ConsumerKey = ConfigurationManager.AppSettings["ConsumerKey"];

                   credentials.ConsumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"];


               credentials.OAuthToken = "db.OAuthToken";

               credentials.AccessToken = "db.AccessToken";

               auth = new MvcAuthorizer


                   Credentials = credentials


twitterCtx = new TwitterContext(auth);

if (auth.IsAuthorized)


          User user = twitterCtx.UpdateAccountImage(Server.MapPath("/images/n.jpg"));   ==> Error  : Error while querying Twitter.


Jul 14, 2011 at 3:41 PM


Could you give me more info on the exception, like message and stack trace?  Also, could you pull up Fiddler2 and see what type of response you're getting from Twitter?  This will help me figure out what error you're receiving.



Jul 15, 2011 at 12:12 PM


This is that i have received error :

LinqToTwitter.TwitterQueryException was unhandled by user code  Message=Error while querying Twitter.  Source=LinqToTwitter  StackTrace:       

at LinqToTwitter.TwitterExecute.PostTwitterImage[T](String url, IDictionary`2 postData, Byte[] image, String fileName, String imageType, IRequestProcessor`1 reqProc)       

at LinqToTwitter.TwitterExecute.PostTwitterFile[T](String url, IDictionary`2 postData, String filePath, IRequestProcessor`1 reqProc)       

at LinqToTwitter.TwitterContext.UpdateAccountImage(String imageFilePath, Action`1 callback)       

at LinqToTwitter.TwitterContext.UpdateAccountImage(String imageFilePath)     

at TwitterApiTest.Controllers.TwitController.Index() in D:\Projects\TwitterApiTest\TwitterApiTest\Controllers\TwitController.cs:line 112       

at lambda_method(Closure , ControllerBase , Object[] )       

at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)       

at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)       

at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)       

at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()       

at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)  InnerException: System.Net.WebException       

Message=The remote server returned an error: (417) Expectation Failed.       Source=LinqToTwitter       StackTrace:           

at LinqToTwitter.TwitterExecute.PostTwitterImage[T](String url, IDictionary`2 postData, Byte[] image, String fileName, String imageType, IRequestProcessor`1 reqProc)       InnerException: 


I can not see any error becouse there is a problem while connect to twitter api over fiddler2.



Jul 15, 2011 at 2:32 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.