Re: How to fetch the default HTTP proxy

From: Bob Altman (rda_at_nospam.com)
Date: 06/16/04


Date: Wed, 16 Jun 2004 11:23:36 -0700

Sorry, I'm missing something really fundamental here...

I apparently don't need to do authentication. (The authentication stuff in
my original example was just copied-and-pasted from the example in the MSDN
docs.) If I remove all references to Credentials, my code still works as
before. As near as I can tell, the minimum code that I need to access a
website in code is:

    ' These two lines are necessary to get through the firewall
    Dim proxy As New WebProxy("<My proxy name:8080>")
    GlobalProxySelection.Select = proxy

    Dim url As String = "<desired website>"
    Dim wr As HttpWebRequest = DirectCast(WebRequest.Create(url),
HttpWebRequest)
    dim response as HttpWebResponse = DirectCast(wr.GetResponse(),
HttpWebResponse)

I just don't want to hard-code my proxy address in my code. But if I remove
the first two code lines, the call to GetResponse fails.

As another attempt to get this to work, I created an app.config file and put
the following into it:

  <?xml version="1.0" encoding="utf-8" ?><configuration>
  <configuration>
    <system.net>
      <defaultProxy>
        <proxy usesystemdefault="true" />
      </defaultProxy>
    </system.net>
  </configuration>

Then I removed the GlobalProxySelection stuff and tried it. Still doesn't
work.



Relevant Pages

  • Re: Proxy server with HttpListener
    ... class using sockets that will write the authentication details to your ... that captured HTTP request to your company proxy. ... How can I send the HttpListenerRequest to the internet and put the ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: httpwebrequest with https behind proxy with authentication
    ... contact Microsoft Customer Support ... httpwebrequest with https behind proxy with authentication ... Our proxy server uses NTLM authentication and as you suggested I ...
    (microsoft.public.dotnet.framework)
  • RE: HttpWebRequest over Https Via Proxy Fails using NTLM
    ... request a resource over HTTPS is failing following the installation of a new ... proxy server on our internal network with 407 Proxy Authentication Required. ... Is there any way to debug the ntlm authentication module to see exactly what ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Wi-fi hotspot implementations
    ... FreeBSD, using php and mysql for the authentication, squid for the ... have authenticated full access through the proxy. ... This strikes me as a bit of overkill for a coffee shop. ... Proxy servers are nice for security and anonymity, ...
    (alt.internet.wireless)
  • Re: httpwebrequest with https behind proxy with authentication
    ... Our proxy server uses NTLM authentication and as you suggested I modified the code as follows: ... I still receive "The remote server returned an error: Proxy Authentication Required." ... and it works if I use http instead of https or if I disable authentication on the proxy ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework)