Error: Invalid token for impersonation - it cannot be duplicated

G

Guest

We randomly get an error "System.ArgumentException: Invalid token for
impersonation - it cannot be duplicated" when executing


IntPtr logonToken= WindowsIdentity.GetCurrent().Token;

WindowsIdentity windowsIdentity = new WindowsIdentity(logonToken);
 
V

Vadym Stetsiak

Hello, Chavdar!

Do you get this for different users? What is there in the Security Audit
event log?
--
With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com

You wrote on Fri, 12 Oct 2007 16:49:01 -0700:

C> We randomly get an error "System.ArgumentException: Invalid token for
C> impersonation - it cannot be duplicated" when executing


C> IntPtr logonToken= WindowsIdentity.GetCurrent().Token;

C> WindowsIdentity windowsIdentity = new WindowsIdentity(logonToken);
 
G

Guest

Hi,

We get this for some users and not others. We tracked it down to the
following:

Our programs are .NET 2.0. The computers exibiting the issue had .NET 2.0
AND .NET 3.0 installed. After we uninstalled .NET 3.0 the problem went away.

This to be is a bug somewhere in the framework - not sure where....2.0 or 3.0.

Please help.

Thanks
 
V

Vadym Stetsiak

Hello, Chavdar!

When creating WindowsIdentity object token passed to the constructor is
duplicated.
However, to do this as far as I remember special privileges are needed.

--
With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com

You wrote on Tue, 23 Oct 2007 10:21:12 -0700:

C> Hi,

C> We get this for some users and not others. We tracked it down to the
C> following:

C> Our programs are .NET 2.0. The computers exibiting the issue had .NET
C> 2.0
C> AND .NET 3.0 installed. After we uninstalled .NET 3.0 the problem
C> went away.

C> This to be is a bug somewhere in the framework - not sure
C> where....2.0 or 3.0.

C> Please help.

C> Thanks


C>>> We randomly get an error "System.ArgumentException: Invalid token
C>>> for impersonation - it cannot be duplicated" when executing


C>>> IntPtr logonToken= WindowsIdentity.GetCurrent().Token;

C>>> WindowsIdentity windowsIdentity = new WindowsIdentity(logonToken);
 
G

Guest

Hi Vadym,

1. Who/what duplicates the token?
2. Why does this work under .NET 2.0 and blows up sporadically under .NET 3.0?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top