I had the following in a .NET Framework 4.0 assembly:
var newId= new WindowsIdentity(duplicateTokenHandle);
WindowsImpersonationContext newId = ImpersonatedI
As @Tratcher mentioned you can use the RunImpersonated in .netstandard. The following code sniped is taken from here.
var user = (WindowsIdentity)context.User.Identity;
#if NET461
using (user.Impersonate())
#else
WindowsIdentity.RunImpersonated(user.AccessToken, () =>
#endif
{
// var useri = WindowsIdentity.GetCurrent();
}
#if !NET461
);
#endif