Re: Is there a way to explicitly set the hosts header on HttpWebRequest by Young
Young
Thu Oct 23 09:36:07 CDT 2003
However, the following code will result in the exception given below:
HttpWebRequest req =
(HttpWebRequest)WebRequest.Create(https://www.myserver.com);
req.Method = "POST";
req.ContentType = "text/xml";
req.Headers.Add("Host: www.myserver.com");
...
An unhandled exception of type 'System.ArgumentException' occurred in
System.dll
Additional information: This header must be modified with the appropriate
property.
However, the HttpWebRequest does not have a "Host" property.
Y.
"Alex Feinman [MVP]" <public_news@alexfeinman.com> wrote in message
news:O8eh5SQmDHA.2012@TK2MSFTNGP12.phx.gbl...
> Yes, HttpWebRequest has Headers property, to which you can add
>
> "Young Cho" <REMOVE_THIS_youngcho_sd@hotmail.com> wrote in message
> news:uQg5XpOmDHA.2000@TK2MSFTNGP12.phx.gbl...
> > I am trying to use HTTP 1.0 and the HttpWebRequest.Create() to POST XML
> > data. Is there a way to explicitly set the hosts header?
> >
> > Thank you!
> > Young.
> >
> >
>
>