Compartir a través de


Birthdate

Birthdate

The Birthdate attribute of the core profile contains the Microsoft® .NET Passport user's birth year or birth date.

Description

The Birthdate attribute is a VARIANT, with a default value of 0 on initial registration. The return value is 0 unless the Share my other registration information check box in the .NET Passport profile is selected. The return value represents the number of days since (if positive) or before (if negative) the date 12/30/1899.

Validation

Data is provided in the form MM/DD/YYYY where MM specifies the month, DD specifies the day, and YYYY specifies the year (1899 through 2079). Users can choose to provide only the year, not the full date, of their birth. For privacy reasons, Microsoft .NET Passport does not provide birth dates for users under the age of 18.

The following table lists the validation rules and defaults for the Birthdate attribute and its relationship to BDay_precision.

Condition Bday_precision Birthdate value
Birth date deleted or not yet given. 0 Always 01/01/1899
Birth year entered such that the user is 18 or older as of current date. 1 Birth date with year only in format 01/01/YYYY
Birth date entered such that the user is 18 or older as of current date. 2 Full birth date in format MM/DD/YYYY
Birth date entered such that the user is under 18 as of current date (in 1.0 or 1.1 timeframe). 3 Always 01/01/1899
Birth year entered such that the user is under 18 as of current date (in 1.0 or 1.1 timeframe). 3 Always 01/01/1899
The user is under 18. Selected on initial registration (in 1.0 or 1.1 timeframe). 3 Always 01/01/1899
The user is under 13. Selected on initial registration. 4 Always NULL
The user is under 18 but over 13. Selected on initial registration. 5 Always NULL

The database should enforce that the data in the Birthdate attribute gives the correct information for the current BDay_precision. For example, if any value other than 01/01/1899 is detected in an update that sets BDay_precision to 3, the update will fail. A VARIANT (VT_DATE) is used to allow for differences in how dates are handled between Microsoft® Visual Basic® Scripting Edition (VBScript) and JavaScript. Both scripting languages can interpret VT_DATE data.

The database should also enforce that a birth date that indicates a user is a child (that is, under 13 or 14) cannot be edited to circumvent Microsoft® Kids Passport restrictions. This can result in the site's cookies allowing the child to make the change. However, upon the next sign-in, the Birthdate attribute will once again be 0.

Example

The following VBScript example displays the value of the Birthdate attribute.

'Create a Passport Object
Set oMgr = Server.CreateObject("Passport.Manager")
Response.Write ("<br>Your birthdate is " & oMgr.Profile("birthdate"))

The following C# example displays the value of the Birthdate attribute.

PassportIdentity oMgr;
oMgr = (PassportIdentity)User.Identity;
Response.Write ("<br>Your birthdate is " + oMgr.GetProfileObject("birthdate"));

See Also

.NET Passport Profile Schema | Core Profile Table | Manager.Profile | BDay_precision