Need some explaination of CredentialCache.DefaultCredentials

From: Roy Chastain (roy_at_kmsys.com)
Date: 05/14/04


Date: Fri, 14 May 2004 14:15:02 -0400

I have two client applications. They both use remoting to access the same server that is hosted in IIS.

One of the clients is started as a zero-touch install by clicking its link on a web page. The other client is installed on the
client system and attempts to use the remote server.

I have the same code to create the remote channel in both clients.

      ListDictionary channelProps = new ListDictionary();
      channelProps.Add("port", 0);
      channelProps.Add("useDefaultCredentials", true);
                channelProps["credentials"] = CredentialCache.DefaultCredentials;
      SoapServerFormatterSinkProvider serverProvider = new SoapServerFormatterSinkProvider();
      HttpChannel hc = new HttpChannel(channelProps, new SoapClientFormatterSinkProvider(), serverProvider);

Notice the use of useDefaultCredentials and the setting of credentials to CredentialCache.DefaultCredentials.

This code works fine in the client that is loaded and run from the web page. It does not work from the client that is installed
on the client system. The problem when run from the installed client is that the remote object returns a 401 not authorized.

If I remove the line
   channelProps["credentials"] = CredentialCache.DefaultCredentials;
from the installed client, it too works.

I don't really know enough about this to understand the full ramifications of what I have just done. My guess is as follows

Since the download and run client works, I am assuming that IE did authentication and produced the cached DefaultCredentials for
me and that has not happened when I run the installed client.

My question is
1) - Can any provide more information about what is going on?
2) - Is there any reason that I would not want to just remove the same line of code in the download and run client also?
3) - Eventually I am going to need a LOCAL service (hopefully running under SYSTEM) to connect to the server (local on the same
system) but the server will need to be able to authenticate it in some manner. What would I need to do in that case?

Thanks
-------------------------------------------
Roy Chastain
KMSystems, Inc.



Relevant Pages

  • [Full-Disclosure] R: Full-Disclosure Digest, Vol 3, Issue 42
    ... Full-Disclosure Digest, Vol 3, Issue 42 ... SD Server 4.0.70 Directory Traversal Bug ... Arkeia Network Backup Client Remote Access ...
    (Full-Disclosure)
  • RE: Remote connectivity problems
    ... do you mean you have added a remote client to SBS ... If you have hardware VPN tunnel setup using Linksys or others, ... In this scenario you have to configure the SBS Server computer to enable ...
    (microsoft.public.windows.server.sbs)
  • Re: Terminal Services Remote Control
    ... You don't need the Remote Desktop Client on the server, ... how do I get Remote Control ...
    (microsoft.public.win2000.termserv.apps)
  • Re: RWW Disconnecting
    ... I have been connected from a remote site for about 3 ... DHCP server and even a wireless access ... the key codes to for Internet access. ... Client Workstations} ...
    (microsoft.public.windows.server.sbs)
  • Re: RWW Disconnecting
    ... Server to test the issue. ... I understand that remote client encounts following error message when RWW ... I strongly suggest that we rerun the Configure E-mail and Internet ...
    (microsoft.public.windows.server.sbs)