2012-11-12 39 views
0

我想使用代理HttpWebRequest但我的代理地址是http://cdproxy.anadolu.edu.tr/proxy.pac,我不想將我的代理地址更改爲http:// cdproxy。 anadolu.edu.tr。如何使用pac文件HttpWebRequest

如何將此地址用於我的代理?

Encoding encode = System.Text.Encoding.GetEncoding("utf-8"); 
HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(Url); 
CookieContainer cookieJar = new CookieContainer(); 
Request.AllowAutoRedirect = true; 
WebProxy myProxy = new WebProxy(); 
myProxy.Address = new Uri("http://cdproxy.anadolu.edu.tr/proxy.pac"); 
myProxy.Credentials = new NetworkCredential("user", "password"); 
Request.Proxy = myProxy; 
HttpWebResponse Response = (HttpWebResponse)Request.GetResponse(); 

回答