Login with twitter account and fetch profile details Error: An error occured while parsing the Twitter response in ASP.Net

Last Reply one year ago By dharmendr

Posted one year ago

hello sir

i am using the below code and it working but the problem is when i login with my friend account then it giving the error:An error occured while parsing the Twitter response. and i am not able solve please help me to solve it thank in advance

DataTable dt = twitter.FetchProfile();----Error at this line

This one is my id which is working properly

username: @NageshChauhan16

password: password

And when i am using this Id which is given ERROR

username: vnavale51@gmail.com

password: password

.cs code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using ASPSnippets.TwitterAPI;
public partial class CS : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        TwitterConnect.API_Key = "ySHl3wZ6BP7yIuZAZM9TXSgB4";
        TwitterConnect.API_Secret = "Q1LkBJD7qI7eB0TWxkN2x0Bf0Qchnb3DbbzeaCyEIEuqveBY6d";
        if (!IsPostBack) if (!IsPostBack)
            {
                if (TwitterConnect.IsAuthorized)
                {
                    TwitterConnect twitter = new TwitterConnect();

                    //LoggedIn User Twitter Profile Details
                    DataTable dt = twitter.FetchProfile();
                    imgProfile.ImageUrl = dt.Rows[0]["profile_image_url"].ToString();
                    lblName.Text = dt.Rows[0]["name"].ToString();
                    lblTwitterId.Text = dt.Rows[0]["Id"].ToString();
                    lblScreenName.Text = dt.Rows[0]["screen_name"].ToString();
                    lblDescription.Text = dt.Rows[0]["description"].ToString();
                    lblTweets.Text = dt.Rows[0]["statuses_count"].ToString();
                    lblFollowers.Text = dt.Rows[0]["followers_count"].ToString();
                    lblFriends.Text = dt.Rows[0]["friends_count"].ToString();
                    lblFavorites.Text = dt.Rows[0]["favourites_count"].ToString();
                    lblLocation.Text = dt.Rows[0]["location"].ToString();
                    tblTwitter.Visible = true;

                    //Any other User Twitter Profile Details. Here jQueryFAQs
                    //dt = twitter.FetchProfile("jQueryFAQs");
                    //imgOtherProfile.ImageUrl = dt.Rows[0]["profile_image_url"].ToString();
                    //lblOtherName.Text = dt.Rows[0]["name"].ToString();
                    //lblOtherTwitterId.Text = dt.Rows[0]["Id"].ToString();
                    //lblOtherScreenName.Text = dt.Rows[0]["screen_name"].ToString();
                    //lblOtherDescription.Text = dt.Rows[0]["description"].ToString();
                    //lblOtherTweets.Text = dt.Rows[0]["statuses_count"].ToString();
                    //lblOtherFollowers.Text = dt.Rows[0]["followers_count"].ToString();
                    //lblOtherFriends.Text = dt.Rows[0]["friends_count"].ToString();
                    //lblOtherFavorites.Text = dt.Rows[0]["favourites_count"].ToString();
                    //lblOtherLocation.Text = dt.Rows[0]["location"].ToString();
                    //tblOtherTwitter.Visible = true;

                    btnLogin.Enabled = false;
                }
                if (TwitterConnect.IsDenied)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "key", "alert('User has denied access.')", true);
                }
            }
    }

    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (!TwitterConnect.IsAuthorized)
        {
            TwitterConnect twitter = new TwitterConnect();
            twitter.Authorize(Request.Url.AbsoluteUri.Split('?')[0]);
        }
    }
}

 

Posted one year ago

I have checked with the id you have provided. Its working without ant error.

You can check the demo aswell using the below link with your id.

https://www.aspsnippets.com/demos/566/

There is no problem with the dll.

 


Posted one year ago

I have cross checked everything. Its working. You might have issue with your account. Further you can contact twitter support staff.