UserManager<TUser>.GetUserId(ClaimsPrincipal) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the User ID claim value if present otherwise returns null.
public:
virtual System::String ^ GetUserId(System::Security::Claims::ClaimsPrincipal ^ principal);
public virtual string GetUserId (System.Security.Claims.ClaimsPrincipal principal);
public virtual string? GetUserId (System.Security.Claims.ClaimsPrincipal principal);
abstract member GetUserId : System.Security.Claims.ClaimsPrincipal -> string
override this.GetUserId : System.Security.Claims.ClaimsPrincipal -> string
Public Overridable Function GetUserId (principal As ClaimsPrincipal) As String
Parameters
- principal
- ClaimsPrincipal
The ClaimsPrincipal instance.
Returns
The User ID claim value, or null if the claim is not present.
Remarks
The User ID claim is identified by NameIdentifier.
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for