![](/img/trans.png)
[英]Sending e-mail through C#, Exchange and EWS Managed API gives error 407: Request failed - Proxy authentication required. Why?
[英]Error 407 (Proxy Authentication Request) on Web Request via Geocoding API
我正在編寫一段代碼,它將接收用戶輸入的地址,並返回緯度/經度值供以后使用。 為此,我使用了地理編碼 API。 我所擁有的是:
try
{
IGeocoder geo = new GoogleGeocoder() { };
Address[] addresses = geo.Geocode(address.Text).ToArray();
foreach (Address adr in addresses)
{
// just testing it out
MessageBox.Show(adr.Coordinates.ToString());
}
}
catch (Exception ex)
{
// error treating
}
address
是一個文本框,用戶可以在其中輸入地址。 但是,運行時出現 407 錯誤。
我已經閱讀了很多問題並嘗試了他們的解決方案(比如這個,或者這個),但沒有一個奏效。
關於我缺少什么的任何想法?
由於它拋出有關代理的錯誤,您可以嘗試將代理詳細信息設置為GoogleGeocoder 類。
GoogleGeocoder geocoder = new GoogleGeocoder
{
Proxy = new WebProxy
{
Address = new Uri("proxy url"),
Credentials = new NetworkCredential("username", "password")
}
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.