HttpWebRequest and KeepAlive

Jul 30 2008 11:26 AM
Hello,

I have a problem with the HttpWebRequest object and its property KeepAlive. In fact, I made several web calls with HttpWebRequest, with a KeepAlive = true each time.

In the first call, headers of Request are valid :

GET /mapage.php HTTP/1.1
Referer: http://www.monsite.com/
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/x-silverlight-2-b2, */*
Accept-Language: fr
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.1)
UA-CPU: x86
Host: www.monsite.com
Connection: Keep-Alive
Server responds :

HTTP/1.1 200 OK
Date: Tue, 29 Jul 2008 16:17:34 GMT
Server: Apache/2.0.63 (Unix) PHP/5.2.5
X-Powered-By: PHP/5.2.5
Keep-Alive: timeout=1, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
In the next call, I put KeepAlive to true, but headers of my request is :

POST /mapage2.php HTTP/1.1
Referer: http://www.monsite.com/
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/x-silverlight-2-b2, */*
Accept-Language: fr
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.1)
UA-CPU: x86
Content-Type: application/x-www-form-urlencoded
Host: www.monsite.com
Content-Length: 36
Expect: 100-continue
So, my question : why in my second call, which is made with a KeepAlive = true, the string "Connection: Keep-Alive" is not added in headers sended to server ? Is the first response responsible of this problem ?

Thanks in advance
Fran