Home All Groups Group Topic Archive Search About

Error: Invalid token for impersonation - it cannot be duplicated

Author
12 Oct 2007 11:49 PM
Chavdar
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);

Author
22 Oct 2007 9:25 PM
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);
Author
23 Oct 2007 5:21 PM
Chavdar
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

Show quote
"Vadym Stetsiak" wrote:

> 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);
>
>
>
>
Author
23 Oct 2007 8:58 PM
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> "Vadym Stetsiak" wrote:

>> 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
C>>> for impersonation - it cannot be duplicated" when executing


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

C>>> WindowsIdentity windowsIdentity = new WindowsIdentity(logonToken);
Author
23 Oct 2007 9:17 PM
Chavdar
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.


Show quote
"Vadym Stetsiak" wrote:

> 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> "Vadym Stetsiak" wrote:
>
>  >> 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
>  C>>> for impersonation - it cannot be duplicated" when executing
>
>
>  C>>> IntPtr logonToken= WindowsIdentity.GetCurrent().Token;
>
>  C>>> WindowsIdentity windowsIdentity = new WindowsIdentity(logonToken);
>
>
>
>
>

AddThis Social Bookmark Button