Erik Juhlin

Erik Juhlin

  • NA
  • 3
  • 0

Set http request host header

Feb 3 2008 10:03 AM

Hello,

I want to be able to do a http request to an url at a certain IP-address and with a certain host header.
Seems like HttpWebRequest doesn't support this. When I write:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://127.0.0.1/");
request.Headers.Add("Host", "http://www.foo.com/");
...

I get the message: "The 'Host' header cannot be modified directly."

Is there any other way to do this?


Answers (1)