Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
dear all..

i am connecting to a web service to get a specific results and my windows applications download many files according to response from web-service

the problem appears only when using a proxy in my internet explorer using program "analog proxy"
this is the steps i made:
tools->internet options->connections->Lan settings-> and i checked use proxy server for Lan..... with address: 192.168.1.240 and port:6588




my code to connect to web-service is:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.o-survey.com");

IWebProxy proxy = request.Proxy;
if (proxy != null)
{
    MessageBox.Show("Proxy: {0}"+ proxy.GetProxy(request.RequestUri));
}
else
{
    MessageBox.Show("Proxy: {0}Proxy is null; no proxy will be used");
}

WebProxy myProxy = new WebProxy();
Uri newUri = new Uri("http://162.168.1.240:6588");
// Associate the newUri object to 'myProxy' object so that new myProxy settings can be set.
myProxy.Address = newUri;
// Create a NetworkCredential object and associate it with the
// Proxy property of request object.
myProxy.Credentials = new NetworkCredential("john", "johngra");
request.Proxy = myProxy;



and in app.config i put the following line
<system.net>

  <defaultProxy enabled="true" useDefaultCredentials="true" >
  </defaultProxy>

</system.net>


i got this error:


System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 192.168.1.240:6588
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at SystemTray.SQSClient.StockQuoteService.getQuote(String symbol, String terminal) in D:\Graphicano\c# projects\SystemTray\SystemTray\Web References\SQSClient\Reference.cs:line 84
   at SystemTray.Form1.checker(Int32 updater_action, Int32 show_button) in D:\Graphicano\c# projects\SystemTray\SystemTray\MainForm.cs:line 1108



any idea for solving this problem please as soon as possible, i need to solve it quickly

thanks in advance
Posted
Updated 27-Apr-18 6:13am
Comments
Ron Beyer 19-Jun-13 8:10am    
Are you actually running a proxy server on one of your LAN computers? Or are you just trying to route traffic through another computer by IP address?
John_Tadros 19-Jun-13 8:11am    
i am making the proxy on my PC only through internet explorer and analog proxy program

and i am trying to connect to internet through this proxy

You may need to read up on what proxy servers are:

Proxy Server[^]

On the computer that you are trying to connect to and make the proxy, it MUST be running a proxy server. This is a piece of software that re-routes requests. In your case, the 192.168.1.240 computer needs to have a proxy server INSTALLED on it, and configured, to route traffic. Then your other computer can use it as a proxy server. Otherwise it will give a the "unable to connect" message that you are getting.
 
Share this answer
 
Comments
John_Tadros 19-Jun-13 8:19am    
Thanks for your quick reply,

but how to install a proxy server INSTALLED in 192.168.1.240??? and can analog proxy program make this task for me???

thanks in advance for your reply
Ron Beyer 19-Jun-13 8:22am    
At the bottom of the link I gave there are links to servers that you can install. You have to be physically at the machine (192.168.1.240) in order to install it, or have some kind of remote desktop access. I'm not sure what you mean by "analog proxy program"?
John_Tadros 19-Jun-13 8:25am    
thanks alot..

the analog proxy is a program, http://www.analogx.com/contents/download/Network/proxy/Freeware.htm

i will check your solution now


thanks for your help
John_Tadros 19-Jun-13 8:27am    
sorry i pasted a wrong url first
the url is http://www.analogx.com/contents/download/Network/proxy/Freeware.htm
The WebRequest object has a useful property DefaultWebProxy

This returns the IProxy object you're trying to configure based on your systems proxy settings.

http://msdn.microsoft.com/en-us/library/system.net.webrequest.defaultwebproxy.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900