Trying to integrate Twitter with ASP.NET application (Code in C#). This is the code I have written for the first sign in to Twitter.
When I debug the application, I do get the token response and the response redirect happens appropriately.
However, if I host it on IIS and access it, I get a Null Pointer Exception. Why is that?
//Retrieve consumerKey and consumerSecret
var v_consumerKey = ConfigurationManager.AppSettings["consumerKey"];
var v_consumerSecret = ConfigurationManager.AppSettings["consumerSecret"];
//Check if user is a valid user
if (Request.QueryString["oauth_token"] == null)
{
OAuthTokenResponse t_requestToken = OAuthUtility.GetRequestToken(v_consumerKey, v_consumerSecret);
Response.Redirect("http://twitter.com/oauth/authorize?oauth_token=" + t_requestToken.Token);
}
else
{
string s_oAuthToken = Request.QueryString["oauth_token"].ToString();
var v_accessToken = OAuthUtility.GetAccessToken(v_consumerKey,v_consumerSecret,s_oAuthToken);
}