webclient and expect100continue

后端 未结 2 777
小蘑菇
小蘑菇 2021-02-14 21:39

What is the best way to set expect100continue when using WebClient(C#.NET). I have this code below, I still see 100 continue in the header. Stupid apache still complains with 50

2条回答
  •  不知归路
    2021-02-14 22:26

    You need to set the Expect100Continue property on the ServicePoint used for the URI you're accessing:

    var uri = new Uri("http://foo.bar.baz");
    var servicePoint = ServicePointManager.FindServicePoint(uri);
    servicePoint.Expect100Continue = false;
    

提交回复
热议问题