次の方法で共有


MemberIDHigh

MemberIDHigh

The MemberIDHigh attribute of the core profile refers to the high 32 bits of the Microsoft® .NET Passport Unique ID (PUID), the primary key that uniquely identifies a .NET Passport user.

Description

Due to limitations in Component Object Model (COM) data types, a PUID is exposed as two 32-bit integers: MemberIDHigh and MemberIDLow. Participating sites should use the PUID to reference .NET Passport users in their databases. The MemberIDHigh attribute is read-only.

Validation

The MemberIDHigh attribute is a system-specified, read-only value.

Example

The following Microsoft Visual Basic Scripting Edition (VBScript) example displays the value of the MemberIDHigh, MemberIDLow, and the HexPUID attributes. The output shows the hexadecimal values of MemberIDHigh and MemberIDLow are the same as the HexPUID.

'Create a Passport Object
Set oMgr = Server.CreateObject("Passport.Manager")
Dim imemberIdHigh, imemberIdLow, hexmember
'Get the memberIdHigh - a decimal value.
imemberIdHigh = oMgr.Profile("memberIdHigh")
Response.Write ("<br>memberIdHigh = " & imemberIdHigh)
'Get the memberIdLow - a decimal value.
imemberIdLow = oMgr.Profile("memberIdLow")
Response.Write ("<br>memberIdLow = " & imemberIdLow)
'Get the PUID - a hexadecimal value.
Response.Write ("<br>HexPUID = " & oMgr.HexPUID)
'Modify the memberIdHigh and memberIdLow to hexadecimal values, pad
'and concatenate them. The concatenated value is the PUID.
hexmember = String(8 - len(Hex(imemberIdHigh)),"0") & Hex(imemberIdHigh)
hexmember = hexmember + String(8 - len(Hex(imemberIdLow)),"0") & Hex(imemberIdLow)
Response.Write ("<br>memberIdHigh concatenated with memberIdLow = " & hexmember)

The following C# example displays the value of the MemberIDHigh, MemberIDLow, and the HexPUID attributes. The output shows the hexadecimal values of MemberIDHigh and MemberIDLow are the same as the HexPUID.

PassportIdentity oMgr;
oMgr = (PassportIdentity)User.Identity;

int imemberIdHigh;
int imemberIdLow;
string shexmember;
//Get the memberIdHigh - a decimal value.
imemberIdHigh = Convert.ToInt32(oMgr.GetProfileObject("memberIdHigh"));
Response.Write ("<br>memberIdHigh = " + imemberIdHigh);
//Get the memberIdLow - a decimal value.
imemberIdLow = Convert.ToInt32(oMgr.GetProfileObject("memberIdLow"));
Response.Write ("<br>memberIdLow = " + imemberIdLow);
//Get the PUID - a hexadecimal value.
Response.Write ("<br>HexPUID = " + oMgr.HexPUID);
//Modify the memberIdHigh and memberIdLow to hexadecimal values, pad
//and concatenate them. The concatenated value is the PUID.
shexmember = String.Concat(Convert.ToString(imemberIdHigh,16).PadLeft(8,'0'),Convert.ToString(imemberIdLow,16));
Response.Write ("<br>memberIdHigh concatenated with memberIdLow = " + shexmember);

See Also

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