To Get the UserID or UserKey of the logged in User from the ASP.NET membership tables the following snippet will work.

First add the Label Control in the .aspx page

<asp:Label ID="Label_UserInfo" runat="server" Text=""></asp:Label>

Now the snippet in the code behind. In the snippet

User.Identity.Name gets the current loggedin user name of the membership provider.

MembershipUser CurrentUser = Membership.GetUser(User.Identity.Name);

string UserID = CurrentUser.ProviderUserKey.ToString();

Label_UserInfo.Text = User.Identity.Name + " : " + UserID;

UserID provides the current logged in userid.

To use the MembershipUser you should have System.Web.Security Namespace

using System.Web.Security;