Hello everyone,

I am keep getting this error.

Please help me to solve it.

I am using below code 

after grant access I am writing below code

        String token = Request.QueryString["token"];
        Session["token"] = AuthSubUtil.exchangeForSessionToken(token, 
null).ToString();
        GAuthSubRequestFactory authFactory = new 
GAuthSubRequestFactory("cp",
       "exampleCo-exampleApp-1");
        authFactory.Token = (String)Session["token"];
        ContactsService service = new 
ContactsService(authFactory.ApplicationName);
        service.RequestFactory = authFactory;
        StringBuilder sb = new StringBuilder();

        byte[] buf = new byte[8192];

        //do get request
        string weburi = 
"https://www.google.com/m8/feeds/contacts/default/full";;
         Uri uri = new Uri(weburi);
        HttpWebRequest request = (HttpWebRequest)                
        WebRequest.Create(uri);
      
        request.PreAuthenticate = true;
        request.Method = "Get";
        request.ContentType = "application/x-www-form-urlencoded";
        request.Host = "www.google.com";
        request.Accept = "text/html, image/gif, image/jpeg, *; q=.2, */*; 
q=.2";
        request.KeepAlive = true;

      / string header = AuthSubUtil.formAuthorizationHeader(token, null, 
uri, "GET");
      
        request.Headers.Add(header);
        HttpWebResponse response = (HttpWebResponse)
            request.GetResponse();


        Stream resStream = response.GetResponseStream();

        string tempString = null;
        int count = 0;
        //read the data and print it
        do
        {
            count = resStream.Read(buf, 0, buf.Length);
            if (count != 0)
            {
                tempString = Encoding.ASCII.GetString(buf, 0, count);

                sb.Append(tempString);
            }
        }
        while (count > 0);
        Response.Write(sb.ToString());

Please help,

where i am making mistake?

Thanks
Foram

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html

Reply via email to