WebService Client not authenticating through Proxy Server

Discussion in 'ASP .Net Web Services' started by JD, Sep 28, 2004.

  1. JD

    JD Guest

    Hello,

    We have a windows form application that consumes a web service using the
    standard service-proxy class created by "Add Web Reference..." (wsdl.exe). On
    some end-user machines, the app needs to get out through an authenticating
    proxy server to get to the internet.

    In the MSDN docs for the HttpWebClientProtocol.Proxy member, it indicates
    that the default behavior is to use the operating system's settings (Control
    Panel->InternetSettings). We're either misunderstanding what that means or
    finding it not to be the case. When the users in question just open IE and
    browse to the web service end-point, they see it fine. When the app makes the
    request using the web reference, it can't get past the proxy server
    (Unauthorized/401). We've duplicated this on internal test machines as well
    (clients are running XP Pro SP1), with a fairly simple test harness.

    We then looked at using System.Net.CredentialCache.DefaultCredentials, which
    the documentation says will be the current user's username/password/domain
    details. Unfortunately, that didn't seem to work either and all the members
    on DefaultCredentials are blank.

    On the other hand, if we hardcode a login/password/domain in the test
    harness, it connects OK. We would definitely prefer NOT to make our app's
    "Options" dialog include an area for the user's proxy details -- especially
    since we know they've already been specified in the system's "Internet
    Settings" control panel applet.

    Any insight into what the missing piece is for us here?

    Thanks,

    JD
     
    JD, Sep 28, 2004
    #1
    1. Advertising

  2. JD

    Lalitha Guest

    Hi JD,
    When you browse the Web service in IE it will be making Http Get and Http
    Post calls so this will work even you have proxy server setting. When you
    call the web service from client then it will be making Soap calls. You
    need to make changes in machine.config. Check the following articles:
    318140 PRB: Error on .NET client that consumes a Web service through an HTTP
    http://support.microsoft.com/?id=318140
    307220 HOW TO: Configure an XML Web Service Client by Using the .NET
    Framework
    http://support.microsoft.com/?id=307220
    Hope this will resolve your issue.
    Thank you, Lalitha
    Microsoft, Distributed services

    This posting is provided "AS IS", with no warranties, and confers no rights.
     
    Lalitha, Oct 2, 2004
    #2
    1. Advertising

  3. JD

    JD Guest

    Hi Lalitha,

    Thanks for pointing me to those articles. Our Winforms/desktop app doesn't
    ship with a machine.config, as suggested in KB 318140. I suppose it's
    conceivable we could put one on the user's machine, but that may mess up any
    existing one they already have where the framework is installed.

    That same KB article offers a code snippet that it says is supposed to do
    the same thing as the machine.config approach. The problem is that the code
    snippet requires that the URL of the proxy server be specified.

    If we can possibly help it, we'd like to avoid needing the user to specify
    their proxy server address/port. Do you know if there's an equivalent in code
    to the machine.config approach (below), which essentially says "use the
    system settings, period"?

    <system.net>
    <defaultProxy>
    <proxy
    usesystemdefault = "true"
    />
    </defaultProxy>
    </system.net>

    We've been unable to find something that does essentially this via code as
    most examples suggest the specify-an-address approach:

    IWebProxy proxyObject = new WebProxy("http://myproxyserver:80", true);

    Thanks for any assistance you can provide,

    Jeff

    "Lalitha" wrote:

    > Hi JD,
    > When you browse the Web service in IE it will be making Http Get and Http
    > Post calls so this will work even you have proxy server setting. When you
    > call the web service from client then it will be making Soap calls. You
    > need to make changes in machine.config. Check the following articles:
    > 318140 PRB: Error on .NET client that consumes a Web service through an HTTP
    > http://support.microsoft.com/?id=318140
    > 307220 HOW TO: Configure an XML Web Service Client by Using the .NET
    > Framework
    > http://support.microsoft.com/?id=307220
    > Hope this will resolve your issue.
    > Thank you, Lalitha
    > Microsoft, Distributed services
    >
    > This posting is provided "AS IS", with no warranties, and confers no rights.
    >
    >
     
    JD, Oct 4, 2004
    #3
  4. JD

    Lalitha Guest

    Hi JD,
    I want to get some clarification regarding the original question.
    -Do you see the error when trying to add webreference in the ASP.NET web
    app or you are seeing the error when accessing the WebService inside
    ASP.NET Webapp? Can you send the error message?
    -Have you tried using Windows/console app for calling this Web Service? Do
    you see any problems there?
    -Which proxy server is configured in your IE-InternetOptions---Proxy Server
    setting. Is that your Default Proxy server which you want to use now?
    Thank you, Lalitha
    Microsoft, Distributed services

    This posting is provided "AS IS", with no warranties, and confers no rights.
     
    Lalitha, Oct 6, 2004
    #4
  5. JD

    JD Guest

    Hi Lalitha,

    > -Do you see the error when trying to add webreference in the ASP.NET web
    > app or you are seeing the error when accessing the WebService inside
    > ASP.NET Webapp? Can you send the error message?


    The error occurs when our Winforms app, running on a machine that's behind
    the proxy server, calls the web service. The error is the basic HTTP
    Unauthorized message (403, I believe it is).

    > -Have you tried using Windows/console app for calling this Web Service? Do
    > you see any problems there?


    As I mentioned in the original post, this is with a Winforms app. The only
    time it has problems is when trying to reach the web service through an
    authenticating proxy server.

    > -Which proxy server is configured in your IE-InternetOptions---Proxy Server
    > setting. Is that your Default Proxy server which you want to use now?


    Mine has no proxy server. This is on a client machine whose IE options
    contain an IP address and port for their proxy server. We'd like to use those
    settings from our app instead of having to have a separate set of proxy
    options for just our application. Please check the original post for those
    details.

    Thanks,

    JD
     
    JD, Oct 6, 2004
    #5
  6. JD

    Lalitha Guest

    Hello JD,
    In the client machine if the IE options contains an IP address and port for
    their proxy server then it should have updated in the registry
    HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings

    Can you verify the Proxy server in registry and see that got updated?

    Can you send the full error message? Full error message is really important
    to identify the issue
    Thank you,
    Lalitha
    Microsoft, Distributed services

    This posting is provided "AS IS", with no warranties, and confers no rights.
     
    Lalitha, Oct 7, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mrwoopey
    Replies:
    3
    Views:
    9,603
    mrwoopey
    Jun 30, 2003
  2. contrex
    Replies:
    5
    Views:
    62,730
    thebigj816
    Jul 23, 2011
  3. Dermot O'Loughlin

    Problem accessing WebService through Proxy Server

    Dermot O'Loughlin, Dec 1, 2004, in forum: ASP .Net Web Services
    Replies:
    4
    Views:
    525
    Dan Rogers
    Dec 2, 2004
  4. Hanz Gruuber
    Replies:
    0
    Views:
    247
    Hanz Gruuber
    Apr 29, 2005
  5. Adriano Rodrigues Ferreira

    RubyGem behind an authenticating proxy

    Adriano Rodrigues Ferreira, May 4, 2004, in forum: Ruby
    Replies:
    1
    Views:
    164
    Gavin Sinclair
    May 4, 2004
Loading...

Share This Page