1

Hey guys i followed the tutorial here for a school project, https://www.dougv.com/2015/08/posting-status-updates-to-twitter-via-linqtotwitter-part-2-plain-text-tweets/

But when i run it with google chrome nothing is showing up and it just stuck in http://localhost:2860/linq2twitter.aspx which is a blank page, i've checked my twitter the tweet has not been made as well.. from the other sample i've tried i think it is suppose to send me to a authentication page which requires me to login and stuff.. any help is appreciated. Here's my code :

namespace WebApplication3
{
public partial class linq2twitter : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    class Program
    {
        static void Main()
        {
            Console.WriteLine("Program started.");

            try
            {
                var result = Task.Run(() => SendTweet());
                result.Wait();
                if(result == null) {
                Console.WriteLine("Tweet failed to process, but API did not report an error");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("Program completed.");
            Console.Read();
        }

        static async Task<Status> SendTweet()
        {
            var auth = new SingleUserAuthorizer
            {
                CredentialStore = new SingleUserInMemoryCredentialStore
                {
                    ConsumerKey = "<Twitter consumer key>",
                    ConsumerSecret = "<Twitter consumer secret>",
                    AccessToken = "<Twitter access token>",
                    AccessTokenSecret = "<Twitter access token secret>"
                }
            };

            var context = new TwitterContext(auth);

            var status = await context.TweetAsync(
            "Hello World! I am testing @dougvdotcom's #LinqToTwitter demo, at " +
            "https://www.dougv.com/2015/08/posting-status-updates-to-twitter-via-linqtotwitter-part-2-plain-text-tweets"
            );

            return status;
        }
    }
}
}
Joe Mayo
  • 7,501
  • 7
  • 41
  • 60
Kent Ong
  • 97
  • 1
  • 7
  • I removed your secrets from the post. Folks can use those to do bad things on your behalf. You should visit your application on the Twitter site and re-set your keys to prevent anyone from being able to use your keys. BTW, there isn't anything obviously wrong with your code, but you can visit the L2T docs and look at the FAQ to see if it helps. Also, it might help if you look at the Exception being thrown and post that information. A lot of times the Exception will explain what the problem is. – Joe Mayo Dec 10 '15 at 02:40
  • hey thanks for the reply! where do i look for the exception? I'm not familiar with visual studio and couldn't find it... nothing appear in the debug output thingy as well as the one in chrome – Kent Ong Dec 14 '15 at 14:04

1 Answers1

1

Fixed after regenerating my secrets and keys.. and removed unintentional spacebar for my keys in the code. Thx

Kent Ong
  • 97
  • 1
  • 7