IAuthenticationExtension.GetUserInfo(IIdentity, IntPtr) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Restitue l’identité utilisateur actuelle.
public:
void GetUserInfo([Runtime::InteropServices::Out] System::Security::Principal::IIdentity ^ % userIdentity, [Runtime::InteropServices::Out] IntPtr % userId);
public void GetUserInfo(out System.Security.Principal.IIdentity userIdentity, out IntPtr userId);
abstract member GetUserInfo : IIdentity * nativeint -> unit
Public Sub GetUserInfo (ByRef userIdentity As IIdentity, ByRef userId As IntPtr)
Paramètres
- userIdentity
- IIdentity
[dehors] L’identité de l’utilisateur actuel. La valeur de l’IIdentity peut apparaître dans une interface utilisateur et doit être lisible par l’humain.
- userId
-
IntPtr
nativeint
[dehors] Un jeton de compte utilisateur. Ce jeton est principalement utilisé par le serveur de rapports comme handle d’un compte Windows afin de supporter la gestion des identifiants pour l’authentification Windows.
Exemples
Le code d’exemple suivant implémente la GetUserInfo méthode en retournant l’identité principale de la requête HTTP courante.
Public Sub GetUserInfo(ByRef userIdentity As IIdentity, ByRef userId As IntPtr)
' If the current user identity is not null,
' set the userIdentity parameter to that of the current user
If Not (HttpContext.Current Is Nothing) And Not (HttpContext.Current.User Is Nothing) Then
userIdentity = HttpContext.Current.User.Identity
Else
userIdentity = Nothing
End If
' initialize a pointer to the current user id to zero
userId = IntPtr.Zero
End Sub 'GetUserInfo
public void GetUserInfo(out IIdentity userIdentity, out IntPtr userId)
{
// If the current user identity is not null,
// set the userIdentity parameter to that of the current user
if (HttpContext.Current != null
&& HttpContext.Current.User != null)
{
userIdentity = HttpContext.Current.User.Identity;
}
else
userIdentity = null;
// initialize a pointer to the current user id to zero
userId = IntPtr.Zero;
}
Remarques
Le serveur de rapports appelle la GetUserInfo méthode pour chaque requête afin de récupérer l’identité utilisateur actuelle.