How to set custom “Host” header in HttpWebRequest?

后端 未结 5 971
自闭症患者
自闭症患者 2020-12-11 06:54

How can I set a custom Host header in HttpWebRequest? I know that normally this class doesn\'t allow you to do so but is there anyway to use reflection or something like tha

5条回答
  •  醉话见心
    2020-12-11 07:10

    There is a roundabout way to do this, as described here:

    http://blogs.msdn.com/feroze_daud/archive/2005/03/31/404328.aspx

    However, the next version of the framework (.NET Framework 4.0) will make it easier.

    http://blogs.msdn.com/ncl/archive/2009/07/20/new-ncl-features-in-net-4-0-beta-2.aspx

    Hope this helps.

提交回复
热议问题