Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

System.Net.CredentialCache.DefaultNetworkCredentials

3,830 views
Skip to first unread message

william

unread,
Feb 5, 2008, 3:34:25 PM2/5/08
to
Hi,

I want to get current login credentials by using
System.Net.CredentialCache.DefaultNetworkCredentials in my c# windows form
application, but when I exam it by setting breakpoint, it's empty. Why?

Thanks.

william

Henning Krause [MVP - Exchange]

unread,
Feb 5, 2008, 5:40:18 PM2/5/08
to
Hello,

you can't get the username/password of the currently logged on user,
DefaultNetworkCredential is always empty.

What do you need the username/password for?

Kind regards,
Henning

"william" <wil...@discussions.microsoft.com> wrote in message
news:DFA56AC3-F7A6-4B05...@microsoft.com...

william

unread,
Feb 6, 2008, 10:25:03 AM2/6/08
to
Hi Henning,

I want to assign it to a web service's credentials. e.g.
faWS.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

Thanks.

William

Henning Krause [MVP - Exchange]

unread,
Feb 7, 2008, 7:55:18 AM2/7/08
to
Hello,

you can do that - The WebService proxy will use windows authentication in
this case.

Just ignore that it's empty.

Kind regards,
Henning


"william" <wil...@discussions.microsoft.com> wrote in message

news:10407C11-BFE0-4912...@microsoft.com...

Gyanendra Agrawal

unread,
May 24, 2011, 4:04:01 PM5/24/11
to
Hi,

CredentialCache.DefaultCredentials returns empty. but I am not able to call my WCF Service hosted on IIS.
with wsHttpBinding.

I get the following error:

[Win32Exception (0x80004005): The function completed successfully, but must be called again to complete the context]

[SecurityTokenException: Authenticating to a service running under a user account which requires Kerberos multilegs, is not unsupported.]
System.IdentityModel.Tokens.KerberosRequestorSecurityToken.Initialize(TokenImpersonationLevel tokenImpersonationLevel, NetworkCredential networkCredential, SafeFreeCredentials credentialsHandle) +655
System.IdentityModel.Tokens.KerberosRequestorSecurityToken..ctor(String servicePrincipalName, TokenImpersonationLevel tokenImpersonationLevel, NetworkCredential networkCredential, String id, SafeFreeCredentials credentialsHandle) +154

[SecurityTokenValidationException: The NetworkCredentials provided were unable to create a Kerberos credential, see inner execption for details.]
System.IdentityModel.Tokens.KerberosRequestorSecurityToken..ctor(String servicePrincipalName, TokenImpersonationLevel tokenImpersonationLevel, NetworkCredential networkCredential, String id, SafeFreeCredentials credentialsHandle) +303
System.ServiceModel.KerberosSecurityTokenProviderWrapper.GetTokenCore(TimeSpan timeout) +115
System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout) +23
System.ServiceModel.Security.SecurityProtocol.GetToken(SecurityTokenProvider provider, EndpointAddress target, TimeSpan timeout) +52


How do I set the credential from WCF Client.

Thanks

> On Tuesday, February 05, 2008 3:34 PM willia wrote:

> Hi,
>
> I want to get current login credentials by using
> System.Net.CredentialCache.DefaultNetworkCredentials in my c# windows form
> application, but when I exam it by setting breakpoint, it's empty. Why?
>
> Thanks.
>
> william


>> On Tuesday, February 05, 2008 5:40 PM Henning Krause [MVP - Exchange] wrote:

>> Hello,
>>
>> you cannot get the username/password of the currently logged on user,


>> DefaultNetworkCredential is always empty.
>>
>> What do you need the username/password for?
>>
>> Kind regards,
>> Henning


>>> On Wednesday, February 06, 2008 10:25 AM willia wrote:

>>> Hi Henning,
>>>
>>> I want to assign it to a web service's credentials. e.g.
>>> faWS.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
>>>
>>> Thanks.
>>>
>>> William
>>>
>>> "Henning Krause [MVP - Exchange]" wrote:


>>>> On Thursday, February 07, 2008 7:55 AM Henning Krause [MVP - Exchange] wrote:

>>>> Hello,
>>>>

>>>> you can do that - The WebService proxy will use windows authentication in
>>>> this case.
>>>>

>>>> Just ignore that it is empty.
>>>>
>>>> Kind regards,
>>>> Henning

0 new messages