locked
socks proxy and HttpWebRequest (.NET 2.0)

    Question

  • I have a socks proxy ( not it is not a http proxy, but one obtained by example with putty -D 8080 somehost.com )

    How do I redirect my HttpWebRequest to use this proxy, just like I could set up the socks proxy in internet explorer.

    I've seen some examples with HTTP proxy, but it's not the same.

    For example, when I try:

    HttpWebRequest request = (HttpWebRequest)
    WebRequest.Create(@"http://www.whatismyip.com/");
    request.Proxy = new WebProxy("127.0.0.1",8080);
    byte[] c = new byte[1001];
    request.GetResponse().GetResponseStream().Read(c, 0, 1000);

    I get an exception that the underlying connection has been closed.
    It works fine in IE (as socks proxy, and I can telnet to 127.0.0.1 8080)

    Thank you!
    Nick
    Tuesday, April 18, 2006 6:46 PM

Answers

  • We don;t support Socks proxy at this time.
    If you put Socks proxy in the setttings we ignore it for now.
    Could you please describe the scenario to me?

    Sorry for the inconvinience

    Wednesday, April 19, 2006 2:24 AM
    Moderator

All replies

  • We don;t support Socks proxy at this time.
    If you put Socks proxy in the setttings we ignore it for now.
    Could you please describe the scenario to me?

    Sorry for the inconvinience

    Wednesday, April 19, 2006 2:24 AM
    Moderator
  • thanks for your reply.

    the goal is to do httpwebrequests through another server (proxy) so as to gain access to the intranet for example.
    what is given is an ssh connection to this server.

    what would work is to have a local http proxy that tunnels the data through the ssh socks proxy..
    Wednesday, April 19, 2006 4:30 AM
  • The scenario could be obvious:

    The requests detects the SOCKS version (for now 4, 4a or 5), negotiate the authetication, if needed with the supplied porxy credentials (basic authentication or GSSAPI - if such authentication module is registered) and then negotiates the tunnel through SOCKS proxy.

    This seem to be a natural behaviour for a proxy handling.

    BTW, it'd be great to have in .NET Framework the support for proxy not only for web requests... Sometimes I would like to use the proxy for a plain socket connection.

    Regards,

    Nick

    Wednesday, July 26, 2006 10:12 PM