Solved

HttpWebRequest.KeepAlive doesn't create Connection header

Posted on 2009-05-11
6
915 Views
Last Modified: 2013-11-08
Hello Experts,

I'm settings HttpWebRequest.KeepAlive to true, but when I hit a website that displays my headers, the Connection header is missing.  I've tried a few "header viewer" websites, but no luck.  When set to false, I was able to see the header "connection: Close".  what could explain this bizarre behavior?
0
Comment
Question by:sfun28
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 15

Expert Comment

by:oobayly
ID: 24365584
I can't replicate the issue here. I've use an Asp.Net page to return the headers as well as Wireshark to view the actual traffic.
http://www.wireshark.com/

Can you show the code you're executing?
0
 
LVL 15

Expert Comment

by:spprivate
ID: 24365586
What version of IIS are you using.
See if you have done this steps

http://technet.microsoft.com/en-us/library/cc772183(WS.10).aspx
0
 
LVL 1

Author Comment

by:sfun28
ID: 24366644
I'm not using IIS.  I have a WinForm app that tries to fetch a webpage.  Right now I have it fetch a page that shows me the headers I'm sending.  Here's an example of two pages I'm verifying against:
http://www.ericgiguere.com/tools/http-header-viewer.html
http://www.ioerror.us/ip/headers

Right now I have a class that inherits from WebClient.  It overrides GetWebRequest.  Please see the code snippet below.  I've verified that _keepAlive is true.

The strange part is that "Connection: Close" IS sent when _keepAlive is false.  I'm only using other sites to verify this.  I could try wireshark to be doubly-sure.
protected override WebRequest GetWebRequest( Uri address )
        {
 
            WebRequest request = base.GetWebRequest( address );
 
           
            HttpWebRequest httpRequest = request as HttpWebRequest;
 
            if ( httpRequest != null )
            {
 
                httpRequest.KeepAlive = _keepAlive;
                httpRequest.ProtocolVersion = _protocolVersion;
                httpRequest.CookieContainer = CookieContainer;
 
            }
 
            return request;
        }

Open in new window

0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 1

Accepted Solution

by:
sfun28 earned 0 total points
ID: 24772871
no response.  closing out.
0
 

Expert Comment

by:beanqa
ID: 26548637
I have the same issue.  Was this ever resolved?
0
 
LVL 1

Author Comment

by:sfun28
ID: 26549137
unfortunately not.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question