C# HttpWebRequest Fails with 417 Expectation Failed

C# HttpWebRequest Fails with 417 Expectation Failed

使用 C# 的 HttpWebResponse 掛 proxy 作 http post 動作時,返回錯誤訊息 「HTTP/1.0 407 Proxy Authentication Required」

解決方法:

//程式超始時設定
System.Net.ServicePointManager.Expect100Continue = false;
或透過設定檔

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<settings>
<servicePointManager expect100Continue="false"/>
</settings>
</system.net>
</configuration>

參考

 

Dotblogs 的標籤: , ,