|
UserInfoImpersonateUser Method
|
Impersonates the specified user.
Namespace: GSF.IdentityAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.218-beta+101eee949414e414795e55a6e73d88938f0177b8
Syntax Remarks
After impersonating a user the code executes under the impersonated user's identity.
Example
This example shows how to impersonate a user:
using System;
using GSF.Identity;
class Program
{
static void Main(string[] args)
{
Console.WriteLine(string.Format("User before impersonation: {0}", UserInfo.CurrentUserID));
UserInfo.ImpersonateUser("XYZCorp", "johndoe", "password");
Console.WriteLine(string.Format("User after impersonation: {0}", UserInfo.CurrentUserID));
Console.ReadLine();
}
}
See Also