首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

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

2012-05-28 
C#调用WebService 时的代理信息如何在程序中加入 调用WebService 时需要的代理服务器的信息呀?以下调用网

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

热点排行