Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / December 2005

Tip: Looking for answers? Try searching our database.

HttpWebRequest Host header

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
barbutz - 24 Nov 2005 16:33 GMT
Hi,
I use HttpWebRequest to send http requests. I use http version 1.0.
The problem is that for each http 1.0 request the framework automatically
adds the "Host" header. This header is a must for http 1.1 but NOT for http
1.0 (rfc 1945)! I need to send a http 1.0 request without this header. I
tried to delete the header but no success. Is there a way to get rid of it ?

[i use .net framework 2.0]

Thanks.
Joerg Jooss - 24 Nov 2005 21:44 GMT
> Hi,
> I use HttpWebRequest to send http requests. I use http version 1.0.
[quoted text clipped - 3 lines]
> request without this header. I tried to delete the header but no
> success. Is there a way to get rid of it ?

No. The framework sets the host header implicitly. Is it harmful for
your destination server?

Cheers,
Signature

http://www.joergjooss.de
mailto:news-reply@joergjooss.de

barbutz - 25 Nov 2005 14:00 GMT
Not for web server but for proxy server. I have a proxy server that acts
differently when it gets Host header and when it doesn't. I need to test it
both ways of course so right now i can only do one way. Is there anything i
can do? if not than i guess i won't continue to use HttpWebRequest class.

> > Hi,
> > I use HttpWebRequest to send http requests. I use http version 1.0.
[quoted text clipped - 8 lines]
>
> Cheers,
Joerg Jooss - 25 Nov 2005 18:42 GMT
> Not for web server but for proxy server. I have a proxy server that
> acts differently when it gets Host header and when it doesn't. I need
> to test it both ways of course so right now i can only do one way. Is
> there anything i can do? if not than i guess i won't continue to use
> HttpWebRequest class.

I'm afraid not. It's one of the more annoying limitations of
HttpWebRequest :-(

OTOH, that proxy shouldn't choke on a Host header either...

Cheers,

Signature

http://www.joergjooss.de
mailto:news-reply@joergjooss.de

Feroze [msft] - 20 Dec 2005 01:21 GMT
You can craft your own HTTP request and send it using a Socket client...

GET /default.htm HTTP/1.0\r\n
Host: <host hdr value>\r\n
\r\n
\r\n

And you can repeat that request without the Host header line. And see what
the difference is in the proxy's response.

what proxy is this, btw?
Signature

feroze

-----------------
This posting is provided as-is. It offers no warranties and assigns no
rights.

See http://blogs.msdn.com/feroze_daud for System.Net related posts.
----------------

>> Not for web server but for proxy server. I have a proxy server that
>> acts differently when it gets Host header and when it doesn't. I need
[quoted text clipped - 8 lines]
>
> Cheers,

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.