.NET Framework Class Library
MembershipUser.CreationDate Property
Note: This property is new in the .NET Framework version 2.0.
Gets the date and time when the user was added to the membership data store.
Namespace: System.Web.Security
Assembly: System.Web (in system.web.dll)
MembershipUser Members
System.Web.Security Namespace
Assembly: System.Web (in system.web.dll)
Syntax
Visual Basic (Declaration)
Public Overridable ReadOnly Property CreationDate As DateTime
Visual Basic (Usage)
Dim instance As MembershipUser Dim value As DateTime value = instance.CreationDate
C#
public virtual DateTime CreationDate { get; }
C++
public: virtual property DateTime CreationDate { DateTime get (); }
J#
/** @property */ public DateTime get_CreationDate ()
JScript
public function get CreationDate () : DateTime
Property Value
The date and time when the user was added to the membership data store.Remarks
The SqlMembershipProvider sets the CreationDate, LastLoginDate, LastActivityDate, and LastPasswordChangedDate date to the same date and time when a membership user is created by the CreateUser method.
Example
The following code example displays all membership user names in a ListBox and uses labels to show specific membership information for the selected user name, including the CreationDate property for the membership user.
Visual Basic
<%@ Page Language="VB" %> <%@ Import Namespace="System.Web.Security" %> <script runat="server"> Dim users As MembershipUserCollection Public Sub Page_Load() users = Membership.GetAllUsers() If Not IsPostBack Then ' Bind users to ListBox. UsersListBox.DataSource = users UsersListBox.DataBind() End If ' If a user is selected, show the properties for the selected user. If Not UsersListBox.SelectedItem Is Nothing Then Dim u As MembershipUser = users(UsersListBox.SelectedItem.Value) EmailLabel.Text = u.Email IsOnlineLabel.Text = u.IsOnline.ToString() LastLoginDateLabel.Text = u.LastLoginDate.ToString() CreationDateLabel.Text = u.CreationDate.ToString() LastActivityDateLabel.Text = u.LastActivityDate.ToString() End If End Sub </script> <html> <head> <title>Sample: View User Information</title> </head> <body> <form runat="server" id="PageForm"> <h3>View User Information</h3> <table border="0" cellspacing="4"> <tr> <td valign="top"> <asp:ListBox id="UsersListBox" DataTextField="Username" Rows="8" AutoPostBack="true" runat="server" /> </td> <td valign="top"> <table border=0 cellpadding=2 cellspacing=0> <tr> <td>E-mail:</td> <td><asp:Label runat="server" id="EmailLabel" /></td> </tr> <tr> <td>Is Online?:</td> <td><asp:Label runat="server" id="IsOnlineLabel" /></td> </tr> <tr> <td>LastLoginDate:</td> <td><asp:Label runat="server" id="LastLoginDateLabel" /></td> </tr> <tr> <td>CreationDate:</td> <td><asp:Label runat="server" id="CreationDateLabel" /></td> </tr> <tr> <td>LastActivityDate:</td> <td><asp:Label runat="server" id="LastActivityDateLabel" /></td> </tr> </table> </td> </tr> </table> </form> </body> </html>
C#
<%@ Page Language="C#" %> <%@ Import Namespace="System.Web.Security" %> <script runat="server"> MembershipUserCollection users; public void Page_Load() { users = Membership.GetAllUsers(); if (!IsPostBack) { // Bind users to ListBox. UsersListBox.DataSource = users; UsersListBox.DataBind(); } // If a user is selected, show the properties for the selected user. if (UsersListBox.SelectedItem != null) { MembershipUser u = users[UsersListBox.SelectedItem.Value]; EmailLabel.Text = u.Email; IsOnlineLabel.Text = u.IsOnline.ToString(); LastLoginDateLabel.Text = u.LastLoginDate.ToString(); CreationDateLabel.Text = u.CreationDate.ToString(); LastActivityDateLabel.Text = u.LastActivityDate.ToString(); } } </script> <html> <head> <title>Sample: View User Information</title> </head> <body> <form runat="server" id="PageForm"> <h3>View User Information</h3> <table border="0" cellspacing="4"> <tr> <td valign="top"> <asp:ListBox id="UsersListBox" DataTextField="Username" Rows="8" AutoPostBack="true" runat="server" /> </td> <td valign="top"> <table border=0 cellpadding=2 cellspacing=0> <tr> <td>E-mail:</td> <td><asp:Label runat="server" id="EmailLabel" /></td> </tr> <tr> <td>Is Online?:</td> <td><asp:Label runat="server" id="IsOnlineLabel" /></td> </tr> <tr> <td>LastLoginDate:</td> <td><asp:Label runat="server" id="LastLoginDateLabel" /></td> </tr> <tr> <td>CreationDate:</td> <td><asp:Label runat="server" id="CreationDateLabel" /></td> </tr> <tr> <td>LastActivityDate:</td> <td><asp:Label runat="server" id="LastActivityDateLabel" /></td> </tr> </table> </td> </tr> </table> </form> </body> </html>
Platforms
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Version Information
.NET Framework
Supported in: 2.0See Also
Reference
MembershipUser ClassMembershipUser Members
System.Web.Security Namespace