?
Solved

HttpWebRequest.KeepAlive doesn't create Connection header

Posted on 2009-05-11
6
Medium Priority
?
926 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
Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

 
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

752 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