Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

user info

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lamis - 03 Sep 2007 14:36 GMT
WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as
System.Security.Principal.WindowsPrincipal;   

p.Identity.Name tells me userId. how do I get out not only the log in name
but also the name of the person who is inlogged in the system???

Signature

LZ

Muhammad Naveed Yaseen - 03 Sep 2007 15:58 GMT
To best my knowledge would only return an initialized
WindowsPrinicipal if somewhere program had assigned this previously,
otherwise this would just be a blank GenericPrincipal.

If the quoted line of code is working, it appears to me that some
piece of code had previously 'constructed' an object of
WindowsPrincipal by itself and then assigned it as thread's principal.

To get WindowsPrinicipal of current OS logged-in user you may do
following

WindowsPrincipal p = new
WindowsPrincipal(WindowsIdentity.GetCurrent());
Muhammad Naveed Yaseen - 03 Sep 2007 16:01 GMT
To best my knowledge Thread.CurrentPrincipal would only return an
initialized WindowsPrinicipal if somewhere program had assigned this
previously, otherwise this would just be a blank GenericPrincipal.

If the quoted line of code is working, it appears to me that some
piece of code had previously 'constructed' an object of
WindowsPrincipal by itself and then assigned it as thread's
principal.

To get WindowsPrinicipal of current OS logged-in user you may do
following

WindowsPrincipal p = new
WindowsPrincipal(WindowsIdentity.GetCurrent());
Lamis - 04 Sep 2007 08:20 GMT
Hi,

Sorry but I still don't get it. How would I be able to get out full name
(user full name) out of the windowsPrincipal p object???
Signature

LZ

> To best my knowledge Thread.CurrentPrincipal would only return an
> initialized WindowsPrinicipal if somewhere program had assigned this
[quoted text clipped - 10 lines]
> WindowsPrincipal p = new
> WindowsPrincipal(WindowsIdentity.GetCurrent());

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.