views:

434

answers:

2

I need to change the order of headers, I'm using this:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = context.Request.HttpMethod;
request.UserAgent = context.Request.UserAgent;

The output for that is:

GET /* HTTP/1.1
User-Agent: My Server
Host: 127.0.0.1:1080

But it should be

GET /* HTTP/1.1
Host: 127.0.0.1:1080
User-Agent: My Server

Any ideas?

Thanks for your time.

EDIT: Maybe there's a way using other object ... it's also an option

+1  A: 

There was an outstanding complaint that .NET doesn't let you modify the Host header a while back. It might not have been resolved. If it is really that important, you could always write socket-level code to send a prepared request (since it's just text).

Hank Gay
mmmm... yes, I saw a thread about the Host problem.I think I will use sockets then.Thanks.
Matías
A: 

However in this case, it doesnt look like you want to modify the Host header. You just want to change the order.

So, why do you want to change the order?

feroze