Export (0) Print
Expand All

UserNamePasswordServiceCredential.UserNamePasswordValidationMode Property

Gets or sets the method of validating the user name and password.

Namespace: System.ServiceModel.Security
Assembly: System.ServiceModel (in system.servicemodel.dll)

public UserNamePasswordValidationMode UserNamePasswordValidationMode { get; set; }
/** @property */
public UserNamePasswordValidationMode get_UserNamePasswordValidationMode ()

/** @property */
public void set_UserNamePasswordValidationMode (UserNamePasswordValidationMode value)

public function get UserNamePasswordValidationMode () : UserNamePasswordValidationMode

public function set UserNamePasswordValidationMode (value : UserNamePasswordValidationMode)

Not applicable.

Property Value

A value from the enumeration in UserNamePasswordValidationMode.

Possible values are:

If this property is set to Custom, the service uses the object returned by CustomUserNamePasswordValidator to validate user names and passwords in incoming messages.

When the value of this property is set to MembershipProvider, specify the membership provider by setting the MembershipProvider property, and then the membership provider instance specified by the MembershipProvider property will be used to validate the username and password in incoming messages.

The following example gets the value of this property.

// Create a service host.
Uri httpUri = new Uri("http://localhost/Calculator");
ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);

// Create a binding that uses a username/password credential.
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType = MessageCredentialType.UserName;

// Add an endpoint.
sh.AddServiceEndpoint(typeof(ICalculator), b, "UserNamePasswordCalculator");

// Get a reference to the UserNamePasswordServiceCredential object.
UserNamePasswordServiceCredential unpCredential = 
    sh.Credentials.UserNameAuthentication;
// Print out values.
Console.WriteLine("IncludeWindowsGroup: {0}", 
    unpCredential.IncludeWindowsGroups);
Console.WriteLine("UserNamePasswordValidationMode: {0}",
    unpCredential.UserNamePasswordValidationMode);
Console.WriteLine("CachedLogonTokenLifetime.Minutes: {0}",
    unpCredential.CachedLogonTokenLifetime.Minutes );
Console.WriteLine("CacheLogonTokens: {0}",
    unpCredential.CacheLogonTokens );
Console.WriteLine("MaxCachedLogonTokens: {0}",
    unpCredential.MaxCachedLogonTokens );
            
Console.ReadLine();

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2015 Microsoft