Hi All,

I'm trying to track down why my application built on HttpWebRequest and
HttpWebResponse fails to successfully log onto and access some web
resourses, while IE does so without problem. The sequence of requests and
responses culminates in a page for IE but in an exception for my application
of type 'System.Net.WebException': The remote server returned an error:
(504) Gateway Timeout.

Using an http sniffer (Ethereal) I can see that IE is setting the http
request header "Proxy-Connection" to "Keep-Alive" while my application does
not send that header. Yet for each new request I make I include the line of
code:
request.KeepAlive = true;
Any pointers as to why setting my HttpWebRequest's KeepAlive property to
true is not resulting in the "Proxy-Connection" header being set to
"Keep-Alive"?

Cheers,

Tim.

Re: http header Proxy-Connection not set to Keep-Alive by setting HttpWebRequest.KeepAlive to true by Jim

Jim
Wed Dec 29 18:08:19 CST 2004

I'm also encountering this same problem. I have been unable to post
data to a server and the only thing that appears to be diff at this
point is the Connection header attribute is not being set, despite the
KeepAlive prop of HttpWebRequest being set to true.


Tim Regan wrote:
> Hi All,
>
> I'm trying to track down why my application built on HttpWebRequest
and
> HttpWebResponse fails to successfully log onto and access some web
> resourses, while IE does so without problem. The sequence of requests
and
> responses culminates in a page for IE but in an exception for my
application
> of type 'System.Net.WebException': The remote server returned an
error:
> (504) Gateway Timeout.
>
> Using an http sniffer (Ethereal) I can see that IE is setting the
http
> request header "Proxy-Connection" to "Keep-Alive" while my
application does
> not send that header. Yet for each new request I make I include the
line of
> code:
> request.KeepAlive = true;
> Any pointers as to why setting my HttpWebRequest's KeepAlive property
to
> true is not resulting in the "Proxy-Connection" header being set to
> "Keep-Alive"?
>
> Cheers,
>
> Tim.