C#中的私人代理错误 [英] Private Proxy Error in c#
本文介绍了C#中的私人代理错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想在C#桌面应用程序中使用我的私有代理从某些网站获取数据.我正在使用以下代码:
Hello All,
I want to use my private proxy in C# desktop application to get the data from some website. I am using the below code :
WebProxy myProxy = new WebProxy();
myProxy.Address = new Uri("MY_PRIVATE_PROXY:PORT");
myProxy.Credentials = new NetworkCredential("MY_PROXY_ID", "MY_PROXY_PASS");
String loingStr = string.Format("http://www.google.com/");
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(loingStr);
myRequest.Proxy = myProxy;
myRequest.Method = "GET";
WebResponse myResponse = myRequest.GetResponse();
我做得很好,没有错误.
但是当我尝试使用时:
I works great without error.
But When I try to use :
String loingStr = string.Format("http://www.google.com/search?q=money&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a");
在上面的代码中,它给了我以下错误:
远程服务器返回错误:(403)禁止.
请帮帮我.
等待回应.
谢谢
Kapil Waghe
in above code it gives me following error :
The remote server returned an error: (403) Forbidden.
Please help me.
Awaiting response.
Thanks
Kapil Waghe
推荐答案
在指定路径的同时,最好使用@string
While specifying path it is always better to use @string
这篇关于C#中的私人代理错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文