Hello,
Is there a way to associate and set the credentials for a web proxy via the
config file?
We are writing a client program to access both web services (via
HttpWebClientProtocol subclasses) and direct web requests (via WebRequest
subclasses.) In some cases, we need to go thru a WebProxy, and in other
cases, we go direct. We are able to control this in the client's
configuration file (app.config or machine.config) via the optional
<defaultproxy> element, without any code changes (nice!) However, if a given
configured web proxy requires non-anonymous access (that is, the proxy
returns "HTTP 407 - authentication required" errors), it seems we are
required to modify our code by setting the WebProxy.Credentials property
(perhaps to CredentialCache.DefaultCredentials.) The question is this:
instead of doing this in code, is there a way, via the config file, to:
a) configure the client app configured web proxy to use or not to use some
credentials (instead of anonymous)
b) if the proxy is configured in (a) to use credentials, is there a way to
configure the credentials it should use ("default", or in other cases some
specific username/pwd)?
Any help would be much appreciated! Thanks!
[MSFT] - 29 Jul 2005 03:42 GMT
Hello,
I am afraid that there is no such way to set the Credentials in config file
schema. We have to sepcify this in code. Anyway, you still can save it in
config file as customized value and read it out in your code and set the
value to the WebProxy.Credentials property. For example, with
AppSettingsReader Class:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemconfigurationappsettingsreaderclasstopic.asp
Luke
asanford - 29 Jul 2005 12:59 GMT
;( oh well, thanks for the reply!
> Hello,
>
[quoted text clipped - 8 lines]
>
> Luke