Re: Windows Identity simple question ????
- From: "Henning Krause [MVP - Exchange]" <newsgroups_remove@xxxxxxxxxxxxxxxxx>
- Date: Tue, 5 Jun 2007 12:43:12 +0200
Hello,
the Thread.CurrentPrincipal.Identity does not necessarily contain the currently logged on user. Use WindowsIdentity.GetCurrent() for this (or, in case you are using ASP.NET with Integrated authentication but without impersonation, user HttpContext.Current.User).
Best regards,
Henning Krause
"calderara" <calderara@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:C7202059-F1F7-4AAC-89E0-35F88870E36E@xxxxxxxxxxxxxxxx
Dear all,
I am using .NEt.2.0 and trying to get the current identity in order to
retrive the role that my user belongs to.
For that I am using the following code
WindowsIdentity identity = (WindowsIdentity)Thread.CurrentPrincipal.Identity;
WindowsPrincipal pc = new WindowsPrincipal(identity);
When runing that code I hve a runtime excpetion saying that I have an
invalid cast.
identity is a WindowsIdentity object
Thread.CurrentPrincipal.Identity is retruning a GenericIdentity onject ???
which is strange becaseu the class definition says that Identity should
retrun an IIdentidy object but not a generic
What happen here ?
Thnaks for help
regards
serge
.
- Prev by Date: Re: There is a time and/or date difference between the client and server.
- Next by Date: Re: Windows Identity simple question ????
- Previous by thread: There is a time and/or date difference between the client and server.
- Next by thread: Re: Windows Identity simple question ????
- Index(es):
Relevant Pages
|