Share via


IdentityExtensions.FindFirstValue Method

Return the claim value for the first claim with the specified type if it exists, null otherwise.

Namespace:  Microsoft.AspNet.Identity
Assembly:  Microsoft.AspNet.Identity.Core (in Microsoft.AspNet.Identity.Core.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function FindFirstValue ( _
    identity As ClaimsIdentity, _
    claimType As String _
) As String
'Usage
Dim identity As ClaimsIdentity 
Dim claimType As String 
Dim returnValue As String 

returnValue = identity.FindFirstValue(claimType)
public static string FindFirstValue(
    this ClaimsIdentity identity,
    string claimType
)
[ExtensionAttribute]
public:
static String^ FindFirstValue(
    ClaimsIdentity^ identity, 
    String^ claimType
)
static member FindFirstValue : 
        identity:ClaimsIdentity * 
        claimType:string -> string
public static function FindFirstValue(
    identity : ClaimsIdentity, 
    claimType : String
) : String

Parameters

  • identity
    Type: ClaimsIdentity

Return Value

Type: System.String
Returns String.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ClaimsIdentity. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.111) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.111).

See Also

Reference

IdentityExtensions Class

Microsoft.AspNet.Identity Namespace