2
votes

Lets say I want to send 10 requests where each has different URI (same host, but different resource) and I want to reuse the connection in a way that first request creates keep-alive persistent connection which is reused by the following 9 requests. Using WebRequest.Create seems to dedicate the request to specific resource, therefore there needs to be 10 HttpWebRequest objects where each of them is sent with keep-alive header. How does .NET framework reuse HTTP keep-alive connections created with HttpWebRequest class and KeepAlive property? Does it work transparently or the request object needs to be reused manually in code?

1
I like your profile pic very much :) - Soner Gönül

1 Answers

0
votes

I am also looking for a solution to the same problem. As far as I can tell it is not possible because request.RequestURI is just readonly.

My Solution would be to call a "general" front controller with a POST parameter including the wanted command. This controller then calls the wanted command and proxies the response back to you. So you just need to change a POST parameter instead of the whole url.