Compartir a través de


BDay_precision

BDay_precision

The BDay_precision attribute of the core profile defines the precision of the Birthdate attribute.

Description

Microsoft® .NET Passport users are asked to supply information about their date of birth at registration. Users who indicate an age of less than 18 are not required to provide that information. Microsoft .NET Passport records this profile information using two attributes, BDay_precision and Birthdate. For privacy reasons, the exact birth date of users under the age of 18 is not provided in the profile.

The BDay_precision attribute is read-only. This attribute is optional and defaults to 0.

  • 0 = not specified; no information provided.
  • 1 = User is 18 or older, but did not provide month and day of birth.
  • 2 = User is 18 or older, and provided birth date, including month and day.
  • 3 = User is a minor (under 18). Legacy; not for new users.
  • 4 = User is under 13. Use the "Kid bit" flag to determine whether gathering consent is necessary.
  • 5 = User's age is greater than or equal to 13 and less than 18.

Validation

This value may only be 0, 1, 2, 3, 4,  or 5. The user database should enforce that the data provided in Birthdate gives the correct information for the current BDay_precision.

Example

The following Microsoft Visual Basic Scripting Edition (VBScript) example displays the value of the BDay_precision attribute.

Select Case oMgr.Profile("bday_precision")
 Case 0
  'no date specified.
  Response.Write ("<br>Birthdate unknown.")
 Case 1
  'User >=18, year of birth only.
  Response.Write ("<br>You are 18 years old or older.")
 Case 2
  'User >= 18, day, month, and year of birth given.
  Response.Write ("<br>You are 18 years old or older. Month and day provided") 
 Case 3
  'minor; legacy purposes only
  Response.Write ("<br>You are a minor.") 
 Case 4
  'User < 13
  Response.Write ("<br>You are a minor. Consent may be necessary.") 
 Case 5
  '13 =< User > 18
  Response.Write ("<br>You are a young adult.") 
End Select

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

PassportIdentity oMgr;
oMgr = (PassportIdentity)User.Identity;
switch (Convert.ToInt32(oMgr.GetProfileObject("bday_precision")))
{
 case 0:
  //No date specified
  Response.Write ("<br>Birthdate unknown.");
  break;
 case 1:
  //User >=18, year of birth only.
  Response.Write ("<br>You are 18 years old or older.");
  break;
 case 2:
  //User >= 18, day, month, and year of birth given.
  Response.Write ("<br>You are 18 years old or older. Month and day provided.");
  break; 
 case 3:
  //minor; legacy purposes only
  Response.Write ("<br>You are a minor.");
  break;
 case 4:
  //User < 13
  Response.Write ("<br>You are a minor. Consent may be necessary.");
  break; 
 case 5:
  //13 =< User > 18
  Response.Write ("<br>You are a young adult.");
  break; 
}

See Also

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