twitterizer API Value cannot be null. Parameter name: String ASP.NET

875 Views Asked by At

I am using Twitterizer API for accessing twitter related functionality. I have one demo application that works fine with my consumerkey and consumersecret i run this application locally. but when i integrate the same settings in my live application i got this error

Value cannot be null.Parameter name: String

Can anyone tell me why?

Thanks

2

There are 2 best solutions below

0
On BEST ANSWER

Please check you keys. Also check your server time. Sometimes timestamp that we generate give some issues.

5
On

Without a stacktrace or more details, there is absolutely no way I could give you an absolutely accurate answer.

My best guess is that your request is failing, possibly because of DNS, lack of .NET permissions, or misconfigured proxy settings on the server and you're not checking if the ResponseObject is null before trying to use it.

To check for failed requests at runtime (so you can display a nice error without an ugly try/catch), check the Result property of the TwitterResponse<T> you got back from the library.

For example,

OAuthTokens tokens = new OAuthTokens();
tokens.AccessToken = "XXX";
tokens.AccessTokenSecret = "XXX";
tokens.ConsumerKey = "XXX";
tokens.ConsumerSecret = "XXX";

TwitterResponse<TwitterStatus> tweetResponse = TwitterStatus.Update(tokens, "Hello, #Twitterizer");
if (tweetResponse.Result == RequestResult.Success)
{
    // Tweet posted successfully!
}
else
{
    // Something bad happened
}

That code is lifted directly from my homepage.