asp.net成员资格提供用户ID的Guid [英] asp.net membership provider Guid userID
问题描述
我需要(我认为),以获得登录用户ID,这样我就可以更新使用该用户ID作为一个外键我的表之一的电流。的问题是,在该数据库中的用户ID不匹配这样的:
I need (I think) to get the current logged in userID so that I can update one of my tables that uses this userID as a foreign key. The problem is that the userID in the database does not match with this:
Guid currentUser = (Guid)Membership.GetUser().ProviderUserKey;
currentUser.toString();
结果dffaca0c-ae0b-8549-8073-1639985740be
results in dffaca0c-ae0b-8549-8073-1639985740be
而当我看到在数据库中,这是0CCAFADF0BAE498580731639985740BE
whereas when I look in the database, it is 0CCAFADF0BAE498580731639985740BE
为什么他们不同的价值观? (我只有一个用户)。我使用asp.net Oracle数据库和提供者,但不应该使任何区别。
Why are they different values? (I only have one user). I am using an oracle database and provider for asp.net, but shouldn't make any difference.
推荐答案
我相信这是相同的值,但是显示顺序不同。纵观2的值:
I believe these are the same values, but the display order is different. Looking at the 2 values:
dffaca0c-ae0b-8549-8073-1639985740be
0CCAFADF-0BAE-4985-8073-1639985740BE
字节的前3段的顺序是不同的顺序的
The ordering of bytes for the first 3 segments is of a different order:
0CCA FADF => FADF 0CCA => DFFA CA0C == dffaca0c
0BAE => AE 0B == ae0b
4985 => 85 49 == 8549
作为@ x0n评论,这看起来像字节序与Oracle的差异。根据结构的描述,前8个字节的存储方式是依赖于系统,同时的字节顺序最后8个字节是专门大端。
As @x0n comments, this looks like a difference in endianness with Oracle. According the this description of the structure, the endianness of the first 8 bytes is system dependent, while the endianness of the last 8 bytes is specifically big endian.
这篇关于asp.net成员资格提供用户ID的Guid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!