c#web应用程序开发者共享,C#中的Web服务应用程序 -

Hello,

I am using my C# application to send SMS through web service. During the execution of my code, when control reaches to try catch block,that is req.GetResponse() i am getting an errorError is - "The remote server returned an error:(407)Proxy authentication required"

The code what i have written is string url = "valid url";

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

NetworkCredential netcredit = new NetworkCredential("username", "password", "domain");

req.Credentials = netcredit;

System.Net.WebProxy pry = new WebProxy("192.168.1.4:1598", true);

pry.Credentials = netcredit;

req.Proxy = pry;

req.Method = "HEAD";

try

{

HttpWebResponse res = (HttpWebResponse)req.GetResponse();

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

return;

}

Please help to solve this error

rgds

解决方案Dear Friend,

Either the credentials you are providing are incorrect or Check with your firewall expert. They open the firewall for PROD servers so there is no need to use the Proxy.

OR

You have to set the Credentials in two locations to get past the 407 error:

HttpWebRequest webRequest = WebRequest.Create(uirTradeStream) as HttpWebRequest;

webRequest.Proxy = WebRequest.DefaultWebProxy;

webRequest.Credentials = new NetworkCredential("user", "password", "domain");

webRequest.Proxy.Credentials = new NetworkCredential("user", "password", "domain")

If the above things don''t work out then follow the link

http://blogs.msdn.com/b/jpsanders/archive/2009/03/24/httpwebrequest-webexcepton-the-remote-server-returned-an-error-407-proxy-authentication-required.aspx[^]

Don''t forget to mark this as your answer if it helps you out.

Thanks

Check if this thread on StackOverFlow is of any help.

407 proxy authentication required[^]

when i remove domain name from networkwork credentaial it works

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值