problème de Connexion application web


#1

Voilà mon code mais ca ne fonctionne pas:

private string _consumerKey = "kOQVGWXlY2XAAOpmTaPGpQ"; private string _consumerSecret = "uNvORdD5XuhKl7LuLBOUgOQ8f0VTbDdJOBhkosnY";
   public ActionResult Authorize()
    {
        // Step 1 - Retrieve an OAuth Request Token
        TwitterService service = new TwitterService(_consumerKey, _consumerSecret);

        var url = Url.Action("AuthorizeCallback", "Auth", null, "http");
        // This is the registered callback URL
        OAuthRequestToken requestToken = service.GetRequestToken(url);
        

        // Step 2 - Redirect to the OAuth Authorization URL
        Uri uri = service.GetAuthorizationUri(requestToken);
        return new RedirectResult(uri.ToString(), false /*permanent*/);
    }

    // This URL is registered as the application's callback at http://dev.twitter.com
   public ActionResult AuthorizeCallback(string oauth_token, string oauth_verifier)
   {
       var requestToken = new OAuthRequestToken { Token = oauth_token };
       requestToken.OAuthCallbackConfirmed = true;
       requestToken.TokenSecret = "isKNyEotje1VfHmsBEafGLLDoQVJPSV5yLfnNMrc1F2AD";
       requestToken.Token = "2351484428-LV3uWnI9nbLQaqq8nUDS84HGeQApSyiUio1HsmT";

       // Step 3 - Exchange the Request Token for an Access Token
       TwitterService service = new TwitterService(_consumerKey, _consumerSecret);
       OAuthAccessToken accessToken = new OAuthAccessToken();

       accessToken = service.GetAccessToken(requestToken, oauth_verifier);
  
       // Step 4 - User authenticates using the Access Token
       service.AuthenticateWith(accessToken.Token, accessToken.TokenSecret);
  
       TwitterUser user = service.VerifyCredentials();
       FormsAuthentication.SetAuthCookie(user.ScreenName, false);

       return RedirectToAction("Index", "Home");
   }

#2