Export (0) Print
Expand All

WebClientProtocol::Credentials Property

Gets or sets security credentials for XML Web service client authentication.

Namespace:  System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)

public:
property ICredentials^ Credentials {
	ICredentials^ get ();
	void set (ICredentials^ value);
}

Property Value

Type: System.Net::ICredentials
The ICredentials for the XML Web service client.

When using the Credentials property, a XML Web service client must instantiate a class implementing ICredentials, such as NetworkCredential, and then set the client credentials specific to the authentication mechanism. The NetworkCredential class can be used to set authentication credentials using the basic, digest, NTLM and Kerberos authentication mechanisms.

When the Credentials property is set to CredentialCache::DefaultCredentials then the client negotiates with the server to do Kerberos and/or NTLM authentication depending on how the server is configured.

The following example is an ASP.NET Web Form, which calls an XML Web service named Math. Within the EnterBtn_Click function, the Web Form explicitly sets authentication credentials using the Credentials property. The user name, password and domain are passed into the constructor for the NetworkCredential class.

Security noteSecurity Note:

This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see.

No code example is currently available or this language may not be supported.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft