How can I get the guid for an authenticated user?

Prysson
Prysson used Ask the Experts™
on
How can I get the guid for an authenticated user?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Guid gUniqueId = (Guid)Membership.GetUser().ProviderUserKey;

provided that the MembershipProvider you are using actually HAS a Guid as a unique key. Some providers use a different method. If you really want to be sure that you can get the user, you should really use the username instead.

Cheers,
CJ.

Author

Commented:
How would I collect the username?
Commented:
Page.User.Identity.Name

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial