UserId System.Security.Principal.IPrincipal

.UserId()

Takes an IPrincipal user (primarily ASP.Net Identity) and collects the ID field and converts it into a Guid.

Method

public static Guid UserId(this System.Security.Principal.IPrincipal user)
System.Security.Principal.IPrincipal user

The User to collect the ID property and convert into a Guid.

Example

C#
Guid id = User.UserId();