Getting the userID of a logged in User in ASP.NET

How can I get the exact ID of a user that is logged into a site?

I'm using the login and registration controls created by Visual Studio 2010, in the database the unique identifier is in this 28e8957e-00b8-4e75-bec9-2b90e640962d for example how can I return the exact one to be used in an SQL command for example?

Answers


Use

using System.Web.Security;

Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey;

Need Your Help

How to HitTest several objects at the same time in AS2.0?

flash object actionscript-2 hittest

So I am making a game on AS2.0 where you control a square you can move and you are supposed not to touch any of the walls or else the level resets andyou go back to the initial position. I've manag...

Xcode 4 and Interface Builder: Editing Vertical Spacing Constraint (Anchor Top, not Bottom)

ios xcode cocoa-touch interface-builder xib

I've got a widget that is not laying out correctly on device (its looks OK in IB, but its not quite right). The widget is a label and its located about mid-screen. Interface Builder gave it a Verti...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.