Solved

HttpWebRequest.KeepAlive doesn't create Connection header

Posted on 2009-05-11
6
902 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
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now