UserNamePasswordValidator Class
.NET Framework 3.0
Validates a username and password.
Namespace: System.IdentityModel.Selectors
Assembly: System.IdentityModel (in system.identitymodel.dll)
Assembly: System.IdentityModel (in system.identitymodel.dll)
Use the UserNamePasswordValidator class to specify how a username and password is validated. This can be done by deriving a class from UserNamePasswordValidator and override the Validate method.
Public Class MyCustomUserNameValidator Inherits UserNamePasswordValidator ' This method validates users. It allows two users, test1 and test2 ' with passwords 1tset and 2tset respectively. ' This code is for illustration purposes only and ' MUST NOT be used in a production environment because it is NOT secure. Public Overrides Sub Validate(ByVal userName As String, ByVal password As String) If Nothing = userName OrElse Nothing = password Then Throw New ArgumentNullException() End If If Not (userName = "test1" AndAlso password = "1tset") AndAlso Not (userName = "test2" AndAlso password = "2tset") Then Throw New SecurityTokenException("Unknown Username or Password") End If End Sub 'Validate End Class 'MyCustomUserNameValidator
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.Community Additions
ADD
Show: