Przeczytaj w języku angielskim Edytuj

Udostępnij za pośrednictwem


UserNamePasswordClientCredential.UserName Property

Definition

Gets or sets the user name.

public string UserName { get; set; }

Property Value

The user name.

Examples

To get or set this property, access the UserNamePasswordClientCredential object from the UserName property from the client object, as shown in the code below.

WSHttpBinding myBinding = new WSHttpBinding();
myBinding.Security.Mode = SecurityMode.Message;
myBinding.Security.Message.ClientCredentialType =
    MessageCredentialType.UserName;

CalculatorClient client = new CalculatorClient("default");

client.ClientCredentials.UserName.Password = ReturnPassword();

client.ClientCredentials.UserName.UserName = ReturnUsername();

Remarks

For user name/password authentication, this property is required and cannot be null or empty.

Applies to

Produkt Wersje
.NET Core 1.0, Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0