Solved

HttpWebRequest.KeepAlive doesn't create Connection header

Posted on 2009-05-11
6
919 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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

696 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