Should I use the username, or the user’s ID to reference authenticated users in ASP.NET

You should use some unique ID, either the GUID you mention or some other auto generated key. However, this number should never be visible to the user.

A huge benefit of this is that all your code can work on the user ID, but the user’s name is not really tied to it. Then, the user can change their name (which I’ve found useful on sites). This is especially useful if you use email address as the user’s login… which is very convenient for users (then they don’t have to remember 20 IDs in case their common user ID is a popular one).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)