Need to set username and password in web.config for ISA Proxy for WCF client

Discussion in 'ASP .Net Web Services' started by Andrew Jocelyn, Dec 2, 2008.

  1. Hi

    I need to explicity set a username and password in the web.config file of a
    SharePoint server to use a ISA proxy server. Aparantly the ISA server won't
    accept credentials if they are not the currently logged on user. Real code
    examples needed please.

    <system.serviceModel>
    <bindings>
    <basicHttpBinding>
    <binding name="ServiceSoap"
    closeTimeout="00:01:00"
    openTimeout="00:01:00"
    receiveTimeout="00:10:00"
    sendTimeout="00:01:00"
    allowCookies="false"
    hostNameComparisonMode="StrongWildcard"
    maxBufferSize="65536"
    maxBufferPoolSize="524288"
    maxReceivedMessageSize="65536"
    messageEncoding="Text"
    textEncoding="utf-8"
    transferMode="Buffered"
    useDefaultWebProxy="false"
    bypassProxyOnLocal="false"
    proxyAddress="http://localhost:8888/">
    <readerQuotas maxDepth="32" maxStringContentLength="8192"
    maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"
    />
    </binding>
    </basicHttpBinding>
    </bindings>
    <client>
    <endpoint address="http://endpoint/service.asmx"
    binding="basicHttpBinding" bindingConfiguration="ServiceSoap"
    contract="Service.ScsServiceSoap" name="ServiceSoap"/>
    </client>
    </system.serviceModel>

    This doesn't work if useDefaultWebProxy is true in the basicHttpBinding.

    <system.net>
    <defaultProxy>
    <proxy usesystemdefault="True" proxyaddress=http://localhost:8888 />
    </defaultProxy>
    </system.net>

    Many thanks
    Andrew
    Andrew Jocelyn, Dec 2, 2008
    #1
    1. Advertising

  2. Andrew Jocelyn

    Steven Cheng Guest

    Hi Andrew,

    From your description, I understand that you have a sharepoint server which
    contains some code that invoke a remote WCF service. And since the WCF
    service is accessed through a ISA proxy, you're wondering how to specify
    the username/password credentials for the ISA proxy's authentication,
    correct?

    If so, I think the problem here is that web.config(or app.config) file only
    contains the proxy address info(such as whether use system default one or
    your cusotm proxy address). There is no configuration entry for you to
    supplyl the authentication credentials for proxy.

    For your case, I've also handled a former issue with the similar scenario.
    In WCF if you need to perform authentication against a proxy server, and
    the credentials for the proxy server authentication is different from your
    WCF client's process account(security context), you might consider using
    the following means:

    1. still set the <system.net> and WCF <binding> useDefaultWebProxy to true.
    In such cases, the WCF runtime will retrieve proxy info from the
    "WebRequest.DefaultWebProxy" static property. Thus, you can supply a
    custom WebProxy object at your application's initial stage(with
    authentication credentials ). e.g.

    ===================
    //before your WCF method call executes

    WebProxy wproxy = new WebProxy("new proxy",true);
    wproxy.Credentials = CredentialCache.DefaultNetworkCredentials;// or you
    can construct a custom NetworkCredential from username/password

    WebRequest.DefaultWebProxy = wproxy;

    ===================

    here is the former thread which mentioned details on this:

    #WCF Proxy Server settings not working - cmuelle
    http://www.eggheadcafe.com/software/aspnet/33184113/wcf-proxy-server-setting
    s.aspx

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

    Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 2 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions. Issues of this
    nature are best handled working with a dedicated Microsoft Support Engineer
    by contacting Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.





    --------------------
    >From: "Andrew Jocelyn" <>
    >Subject: Need to set username and password in web.config for ISA Proxy for

    WCF client
    >Date: Tue, 2 Dec 2008 18:39:46 -0000


    >
    >Hi
    >
    >I need to explicity set a username and password in the web.config file of a
    >SharePoint server to use a ISA proxy server. Aparantly the ISA server won't
    >accept credentials if they are not the currently logged on user. Real code
    >examples needed please.
    >
    ><system.serviceModel>
    > <bindings>
    > <basicHttpBinding>
    > <binding name="ServiceSoap"
    > closeTimeout="00:01:00"
    > openTimeout="00:01:00"
    > receiveTimeout="00:10:00"
    > sendTimeout="00:01:00"
    > allowCookies="false"
    > hostNameComparisonMode="StrongWildcard"
    > maxBufferSize="65536"
    > maxBufferPoolSize="524288"
    > maxReceivedMessageSize="65536"
    > messageEncoding="Text"
    > textEncoding="utf-8"
    > transferMode="Buffered"
    > useDefaultWebProxy="false"
    > bypassProxyOnLocal="false"
    > proxyAddress="http://localhost:8888/">
    > <readerQuotas maxDepth="32" maxStringContentLength="8192"
    >maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"
    >/>
    > </binding>
    > </basicHttpBinding>
    > </bindings>
    > <client>
    > <endpoint address="http://endpoint/service.asmx"
    >binding="basicHttpBinding" bindingConfiguration="ServiceSoap"
    >contract="Service.ScsServiceSoap" name="ServiceSoap"/>
    > </client>
    ></system.serviceModel>
    >
    >This doesn't work if useDefaultWebProxy is true in the basicHttpBinding.
    >
    ><system.net>
    > <defaultProxy>
    > <proxy usesystemdefault="True" proxyaddress=http://localhost:8888

    />
    > </defaultProxy>
    ></system.net>
    >
    >Many thanks
    >Andrew
    >
    >
    >
    >
    Steven Cheng, Dec 3, 2008
    #2
    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. J.S.
    Replies:
    6
    Views:
    8,481
  2. Hanz Gruuber
    Replies:
    0
    Views:
    225
    Hanz Gruuber
    Apr 29, 2005
  3. Andrew Jocelyn
    Replies:
    0
    Views:
    672
    Andrew Jocelyn
    Nov 29, 2008
  4. Replies:
    0
    Views:
    634
  5. SESDev
    Replies:
    6
    Views:
    2,764
    manjerekar annaji rao
    Oct 29, 2009
Loading...

Share This Page