读书人

C#调用WebService 时的代理信息,该怎么

发布时间: 2012-05-28 17:59:33 作者: rapoo

C#调用WebService 时的代理信息
如何在程序中加入 调用WebService 时需要的代理服务器的信息呀?

以下调用网上天气信息时出错:

private void button1_Click(object sender, EventArgs e)
{
weathertest.WeatherWebService test = new weathertest.WeatherWebService();

test.getWeatherbyCityName("东莞");

}


The request failed with HTTP status 407: Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied. ).


注:我是在公司内部访问,有防火墙,但我有权限 (登录名,密码,及端口),怎样将这些信息提供给程序,好让程序能冲破防火墙正常取到我要的内容呀?

非常感谢!



[解决办法]
using System.Net;

WebProxy myProxy = new WebProxy("192.168.0.3:8080",true);

http://msdn.microsoft.com/zh-cn/library/system.net.webproxy.aspx

读书人网 >C#

热点推荐