Using IE proxy server settings in a web service client

Discussion in 'ASP .Net Web Services' started by Kenneth Jonsson, Apr 7, 2010.

  1. I can not make proxy server settings in Internet Explorer work for my web
    service client. When the proxy is defined manually, all is well.

    But, when I import settings from Internet Explorer, the IsBypassed attribyte
    becomes true and the address returned from GetProxy(url) is the same as the
    Url I am entering in the call.
    I do not know how the proxy server is configured, perhaps someone have an
    advice for me or for the administrator of the proxy server?

    When connecting to the network, from my office, through VPN, all is also
    well in both cases. IsBypassed=false and GetProxy returns the address to the
    actual proxy server.
    And when I start IE and try the address of the web service server, I can
    connect to it!

    Reading about proxy servers, it seems it would work automatially, I have
    also tried to run the program without setting the proxy, with same
    dissapointing result.

    I have spent days trying to make IE settings work in my program, but with
    little success, and is wery greatful for any help in this matter.

    Regards,
    Kenneth Jonsson


    public void SetServerProxy(SoapHttpClientProtocol service)
    {
    if (...)
    {
    // Install user proxy settings
    WebProxy userProxy = new WebProxy(ProxyServer);
    NetworkCredential credential = new NetworkCredential(ProxyUser,
    ProxyPassword, ProxyDomain);
    userProxy.Credentials = credential;
    service.Proxy = userProxy;

    }
    else
    {
    // Install default IE proxy settings
    service.Proxy = WebRequest.GetSystemWebProxy();
    service.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials;
    bool isBypassed = service.Proxy.IsBypassed(new Uri(service.Url)); <--
    becomes true
    Uri proxy = service.Proxy.GetProxy(new Uri(service.Url)); <-- is not
    the proxy server defined in Internet Explorer (instead it is the Url entered
    in the call)
    }
    }
     
    Kenneth Jonsson, Apr 7, 2010
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.