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 8422527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:28:28+00:00 2026-06-10T03:28:28+00:00

I am asking this question primarily because I do not have some ideas clear.

  • 0

I am asking this question primarily because I do not have some ideas clear. I belive I understand how a webserver works but for some reason I am getting different results than expected.

So basically I want to replicate what I do with a real web browser with code.

I have a program called Fiddler that acts as a proxy in order to see all the requests and responses from the web server.

1. So when I open my broser and then goto http://10.10.10.28/tfs:8080 this is what shows up:

——– enter image description here

. . . . and this is what fiddler records:

enter image description here

when I click cancel or attempt to log in other requests will be made and fiddler will record more data. I don’t care about that right know I am just interested on simulating this first request.

Anyways so fiddler tels us that the header was:

GET http://10.10.10.28/tfs:8080 HTTP/1.1
Host: 10.10.10.28
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

and the response was:

HTTP/1.1 401 Unauthorized
Server: Microsoft-IIS/7.5
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 12.0.0.6421
Date: Fri, 24 Aug 2012 14:36:22 GMT
Content-Length: 0
Proxy-Support: Session-Based-Authentication

2. Finally getting to the fun part the code Now I will like to send the same header and expect to get the same response. For some reason I get a different response!

public static void Main(string[] args)
{
    // I save the header bytes recorded from fiddler on a file to make sure I am sending the exact same request
    byte[] header = System.IO.File.ReadAllBytes(@"C:\Users\Antonio\Desktop\header");

    // create the client
    TcpClient client = new TcpClient("10.10.10.28", 8080);

    // get the stream so that we can read and write to it
    var stream = client.GetStream();

    // now that we have the stream wait for the server to respond
    WaitForResponse(stream); // waits on a separate thread

    // send the request to the header
    stream.Write(header, 0, header.Length);

    // wait
    Console.Read();
}

public static void WaitForResponse(NetworkStream stream)
{
    Task.Factory.StartNew(() => {
        byte[] buffer = new byte[16384];
        int responseLength = stream.Read(buffer, 0, buffer.Length);
        string resp = System.Text.UTF8Encoding.UTF8.GetString(buffer, 0, responseLength);
        resp = resp; // place breakpoint
    });
    System.Threading.Thread.Sleep(10); // make sure task starts
}

here is the response that I get:
enter image description here

Why am I getting a different response? I believe web servers use a tcp connection to send pages to clients. why is this approach that I am taking not working? Also why is fiddler not recording anything when I send the request to the web-server from code? How does Google chrome connect to the web server? I would bet that the chrome browser is establishing also a tcp connection with the web server.

  • 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-06-10T03:28:29+00:00Added an answer on June 10, 2026 at 3:28 am

    In your example, you connect to port 8080 and request the URL http://10.10.10.28/tfs:8080. So you connect to port 8080 and then request something from port 80. This causes the response of Bad Request.

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

Sidebar

Related Questions

I'm asking this question because I have gone through the tutorial posted here: Preventing
I'm asking and answering my own question , but i'm not assuming i have
Asking this question here because in CakePHP google group got no answer.I have the
I searched before asking this question. I didn't find an answer probably because I
I am finally asking this question as I have never actually found an answer.
I am asking this question here because it is my understanding that this is
I'm asking this question as someone who works for a company with a 70%
Before asking this question I have Googled for this problem and I have looked
Basically, my question is this - I have a list of prices, some of
I feel bad asking this question. I have seen it on SO a couple

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.