WebClient with automatic configuration script proxy setting is not working

Trips

Well-known member
Joined
Aug 7, 2010
Messages
2,788
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri Hi,
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri I am using a .net WebClient to download some images from web. In the Internet Explorer LAN Setting dialog we selected the option of âuse automatic configuration
scriptâ and given the URL of the .pac file. If I navigate to Internet(www.google.com) , it is happening through Proxy server which is given in the script file. But WebClient is not picking up the proxy server which is specified using Configuration script
rather it is connecting to the web without any proxy settings.
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri My C# code and code in the script.pac as follows,
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt webClient.DownloadFileCompleted +=
<span style="color:blue new <span style="color:#2b91af AsyncCompletedEventHandler(wcTest_DownloadFileCompleted);
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt webClient.DownloadFileAsync(<span style="color:blue new
<span style="color:#2b91af Uri(strURL), textBox1.Text);
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri script.pac:
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri function FindProxyForURL(url, orighost) {
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri return PROXY 10.14.12.5:8080;
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri }
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; color:#2b91af; font-size:10pt WebProxy<span style="font-family:"Courier New"; font-size:10pt wp =
<span style="color:blue new <span style="color:#2b91af WebProxy();
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt wp.UseDefaultCredentials =
<span style="color:blue true;
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt wp.Credentials =
<span style="color:#2b91af CredentialCache.DefaultCredentials;
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt webClient.Proxy = wp;
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt or
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt webClient.Proxy
<span style=" = <span style="color:#2b91af WebRequest.DefaultWebProxy;
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt or
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt webClient.Proxy
<span style=" = <span style="color:#2b91af WebRequest.GetSystemWebProxy();
<p style="margin:0in 0in 0pt <span style="font-family:"Courier New"; font-size:10pt
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri But nothing is worked out. Am I missing anything? How can I apply the proxy specified in the script to WebClient.
<p style="margin:0in 0in 0pt <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="font-size:small <span style="font-family:Calibri Thanks in advance

View the full article
 
Back
Top