Authentification via API Twitter

Jun 18, 2012 at 11:35 AM
Edited Jun 18, 2012 at 11:36 AM

I have a method that sends messages to friends, as follows:

   public virtual void SendMessage(Identity identity)

var authent = new MvcAuthorizer
Credentials = new SessionStateCredentials()
ConsumerKey = ConsumerKey,
ConsumerSecret = ConsumerSecret,
OAuthToken = identity.Token.Token,
AccessToken = identity.Token.Secret


when I debug this method the token and key take their value, yet Auth value is null

I am sorry for my bad English,


Jun 19, 2012 at 5:13 AM


I can't tell what the problem is from looking at your code.

One idea is that you might want to make sure you have sessionState mode set to StateServer or SQL so that you don't loose credentials when the Web application recycles.  This is because the SessionStateCredentials class stores credentials in Session state.  Alternatively, you could use InMemoryCredentials and manage the storage of the credentials yourself.  Another option is to write your own ICredentials derived type to encapulate your own credentials management. 

Another idea - Did you ensure that identity contains values?


Jun 19, 2012 at 6:26 PM

I'm replace:

Credentials = new SessionStateCredentials() with Credentials = new InMemoryCredentials()
and its work,