GetUserId (WebSecurity Ref)
Gets the user ID for the specified user. It takes one argument: the user to get the ID for.
Syntax
WebSecurity.GetUserId(string username)
Example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> @if (WebSecurity.IsAuthenticated) { @WebSecurity.GetUserId(WebSecurity.CurrentUserName); } </body> </html>
This example gets the user ID for the current logged in user.
See Also
GetuserIdFromPasswordResetToken