Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3606974
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:19:02+00:00 2026-05-18T21:19:02+00:00

HI i am in desperate need for help here, I am making a web

  • 0

HI i am in desperate need for help here,

I am making a web request and getting a json string with Response.ContentLenth=2246 but when i parse it in a string it gives only few 100 characters, i traked it down that it is only getting values less than 964. strings length is still 2246 but remaining values are just (\0) null characters. Its also giving an error Unterminated string passed in. (2246): at following line

 FacebookFeed feed = sr.Deserialize<FacebookFeed>(data);

It works fine if the response stream contains characters less than 964 chars.

Following is the extract from the full code error encountered in last line.

    System.Web.Script.Serialization.JavaScriptSerializer sr = new System.Web.Script.Serialization.JavaScriptSerializer();
    System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(@"https://graph.facebook.com/100000570310973_181080451920964");
    req.Method = "GET";
    System.Net.HttpWebResponse res = (System.Net.HttpWebResponse)req.GetResponse();

    byte[] resp = new byte[(int)res.ContentLength];
    res.GetResponseStream().Read(resp, 0, (int)res.ContentLength);
    string data = Encoding.UTF8.GetString(resp);
    FacebookFeed feed = sr.Deserialize<FacebookFeed>(data);

error given is

Unterminated string passed in. (2246): {"id":"100000570310973_1810804519209........ (with rest of data in the string data including null chars)

following is the shape of classes used in my code:

public class FacebookFeed
{
    public string id { get; set; }
    public NameIdPair from { get; set; }
    public NameIdPair to { get; set; }
    public string message { get; set; }
    public Uri link{get;set;}
    public string name{get; set;}
    public string caption { get; set; }
    public Uri icon { get; set; }
    public NameLinkPair[] actions { get; set; }
    public string type { get; set; }
    public NameIdPair application { get; set; } //Mentioned in Graph API as attribution
    public DateTime created_time { get; set; }
    public DateTime updated_time { get; set; }
    public FacebookPostLikes likes { get; set; }
}

public class NameIdPair
{
    public string name { get; set; }
    public string id { get; set; }
}

public class NameLinkPair
{
    public string name { get; set; }
    public Uri link{get; set;}
}

public class FacebookPostLikes
{
    public NameIdPair[] data { get; set; }
    public int count { get; set; }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:19:03+00:00Added an answer on May 18, 2026 at 9:19 pm

    You’re assuming that res.GetResponseStream().Read will return the whole response in one go. In fact, Stream.Read() returns the number of bytes that were read – if this is less than the number you’re expecting, you need to keep calling it until all the response chunks have been fetched. You can see this in the example at http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.getresponsestream.aspx.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.