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

  • SEARCH
  • Home
  • 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 6676383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:58:52+00:00 2026-05-26T03:58:52+00:00

i have a strange problem. When i get the response of a httpwebresquest, some

  • 0

i have a strange problem.
When i get the response of a httpwebresquest, some numbers appears in the middle of the html text.

For example:

< input type=”hidden” name=”productid” value=”7220701403

841

89620″ >

That 841 is a number that should not appear, and as such are more every few rows. Even at the beginning:

c04

< html >

< head >

So, it’s impossible to parse the html.

UTF8Encoding encoding = new UTF8Encoding();
byte[] bytes = encoding.GetBytes(postDataString);
request.ContentLength = bytes.Length;
request.ContentType = "application/x-www-form-urlencoded";
request.SendChunked = false;

using (Stream writeStream = request.GetRequestStream())
{
    writeStream.Write(bytes, 0, bytes.Length);
}


response = (HttpWebResponse)request.GetResponse();
Stream remoteStream = response.GetResponseStream();
byte[] buffer = new byte[65536];
int bytesRead = 0;

do
{
    bytesRead = remoteStream.Read(buffer, 0, buffer.Length);
    UTF8Encoding enc = new UTF8Encoding();
    responseString += enc.GetString(buffer);

} while (bytesRead > 0);
remoteStream.Close();

The html text is in variable responseString.

Thanks for any ideas and suggestions.

  • 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-26T03:58:53+00:00Added an answer on May 26, 2026 at 3:58 am

    First, You assume that the server uses UTF8. You also don’t consider how many bytes you read (bytesRead = remoteStream.Read(buffer, 0, buffer.Length))and just convert to whole buffer to string (enc.GetString(buffer)). It should be something like enc.GetString(buffer,0,bytesRead)

    PS: A bytesRead>=0 check could also be needed

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

Sidebar

Related Questions

I have come across a strange problem which I would like to get your
I have a strange problem: I am getting the html source from url using
I have a strange problem on my htc hero. When launching camera, i get
I have strange problem: when I use mu repository stub I get strange exception:
I have a strange problem that I can't get my head around: I have
I try to get a MPMoviePlayerController to work, but have a strange problem. When
I have strange problem with the delay function here using the HTML function with
I have a strange (probably not for some I would wager) problem, I have
This problem is very strange, maybe I have missed some small detail, since I'm
i have strange problem doing reporting: i have numerous clients with different issued invoices.

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.