Getting error after callback 401 unauthorized using aep.net MVC?


#1

i have successfully logged in at twitter but after callback it will give me 401 unauthorized error . i have already set callbackurl in twitter application.i have used DotnetOpenAuth for this implemetation. My code:` var accessToken = response.AccessToken; var userId = response.ExtraData[“user_id”]; var userName = response.ExtraData[“screen_name”];

    var profileRequestUrl = new Uri("https://api.twitter.com/1.1/users/show.json?user_id=" + EscapeUriDataStringRfc3986(userId));
    var profileEndpoint = new MessageReceivingEndpoint(profileRequestUrl, HttpDeliveryMethods.GetRequest);
    var request = WebWorker.PrepareAuthorizedRequest(profileEndpoint, accessToken);

    var extraData = new Dictionary<string, string> { { "accesstoken", accessToken } };

    try
    {
        using (var profileResponse = request.GetResponse())
        {
            using (var responseStream = profileResponse.GetResponseStream())
            {
                var document = xLoadXDocumentFromStream(responseStream);

                AddDataIfNotEmpty(extraData, document, "name");
                AddDataIfNotEmpty(extraData, document, "location");
                AddDataIfNotEmpty(extraData, document, "description");
                AddDataIfNotEmpty(extraData, document, "url");
            }
        }
    }
    catch
    {
        // At this point, the authentication is already successful. Here we are just trying to get additional data if we can. If it fails, no problem.
    }`

at this point i get error=var profileResponcse=request.getResponce()

i googled but didnt found any solution for this, if any know help me.