membership get user id

C#
MembershipUser mu = Membership.GetUser("username");
string userId = mu.ProviderUserKey.ToString();
Source

Also in C#: