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

A

Andrew Jocelyn

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
 
S

Steven Cheng

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:
(e-mail address removed).

==================================================
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.





--------------------
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top