Twitter integration with C#.NET applications - NULL Pointer Exception

Posted by Kanini on Stack Overflow See other posts from Stack Overflow or by Kanini
Published on 2010-06-11T08:07:47Z Indexed on 2010/06/11 8:13 UTC
Read the original article Hit count: 471

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);

        }

© Stack Overflow or respective owner

Related posts about oauth

Related posts about nullpointerexception