MembershipUser Constructor (String, String, Object, String, String, String, Boolean, Boolean, DateTime, DateTime, DateTime, DateTime, DateTime)
Creates a new membership user object with the specified property values.
Assembly: System.Web (in System.Web.dll)
Parameters
- providerName
- Type: System.String
The ProviderName string for the membership user.
- name
- Type: System.String
The UserName string for the membership user.
- providerUserKey
- Type: System.Object
The ProviderUserKey identifier for the membership user.
- Type: System.String
The Email string for the membership user.
- passwordQuestion
- Type: System.String
The PasswordQuestion string for the membership user.
- comment
- Type: System.String
The Comment string for the membership user.
- isApproved
- Type: System.Boolean
The IsApproved value for the membership user.
- isLockedOut
- Type: System.Boolean
true to lock out the membership user; otherwise, false.
- creationDate
- Type: System.DateTime
The CreationDate DateTime object for the membership user.
- lastLoginDate
- Type: System.DateTime
The LastLoginDate DateTime object for the membership user.
- lastActivityDate
- Type: System.DateTime
The LastActivityDate DateTime object for the membership user.
- lastPasswordChangedDate
- Type: System.DateTime
The LastPasswordChangedDate DateTime object for the membership user.
- lastLockoutDate
- Type: System.DateTime
The LastLockoutDate DateTime object for the membership user.
| Exception | Condition |
|---|---|
| ArgumentException | providerName is a null reference (Nothing in Visual Basic). -or- providerName is not found in the Providers collection. |
Creating a new MembershipUser object does not add a new membership user object to the membership data store. To add a new membership user to the membership data store, use the CreateUser method. Note that the CreateUser method returns a MembershipUser object for the membership user added to the data store.
MembershipUser objects can be constructed in application code for use with the UpdateUser method. Alternatively, you can also pass a MembershipUser object returned from the CreateUser, GetUser, GetAllUsers, FindUsersByName, or FindUsersByEmail method to the UpdateUser method as well.
MembershipUser objects are also commonly constructed by membership-provider implementations for the CreateUser, GetUser, GetAllUsers, FindUsersByName, and FindUsersByEmail methods.
The name, email, and passwordQuestion parameters are all trimmed before being used.
The following code example shows an implementation of the CreateUser method for a membership provider. The method constructs a MembershipUser object that is returned when the user is successfully added to the data store.
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
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.