views:

165

answers:

1

Hi there

I'm working on an ASP.net app and i'm trying to impersonate a user

I'm creating a windowsIdentity with a token

WindowsIdentity winId = new WindowsIdenty( token );

this token was got by calling the un managed code

[DllImport("advapi32.dll")]
public static extern int LogonUserA(String lpszUserName, 
    String lpszDomain,
    String lpszPassword,
    int dwLogonType, 
    int dwLogonProvider,
    ref IntPtr phToken);

is there any other way to get a token without using this advapi32.dll unmanaged code?

tks

+2  A: 

Personally, I prefer a wrapper class to handle this Impersonation.

So, you will be working with unmanaged code, but AFAIK there is no way to do this with managed code directly.

jpabluz