PC Review


Reply
Thread Tools Rate Thread

How to detect if I am WindowsImpersonationContext ?

 
 
Guest
Posts: n/a
 
      26th Oct 2005
Hi,
We have a server process that needs at some point to revert to its own
identity to perform some privilege tasks, we do so by calling
WindowsImpersonationContext context = WindowsIndentity.Impersonate
( IntPtr.Zero );

We later call context.Undo(); to revert back to the user's identity.

While performing some taks our server would need to know if it is
performing a task in the user's context or its own context. Is there a way
to determine the context we are currently running in?

Thank you!



 
Reply With Quote
 
 
 
 
Peter Huang [MSFT]
Guest
Posts: n/a
 
      27th Oct 2005
Hi

Based on my understanding, you want to know current user's identity.

WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
String username = wp.Identity.Name;
WindowsPrincipal.Identity Property [C#]
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemsecurityprincipalwindowsprincipalclassidentitytopic.asp

If I have any misunderstanding, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WindowsImpersonationContext and DirectoryServices =?Utf-8?B?SmFrZQ==?= Microsoft C# .NET 0 21st Feb 2005 08:31 PM
WindowsImpersonationContext Sorin Sandu Microsoft ASP .NET 4 13th Aug 2004 06:25 AM
Can sumif detect text strings or detect if a dollar sign $ is in a cell? MollyDavis Microsoft Excel Misc 4 17th Apr 2004 11:45 PM
Can sumif detect text strings or detect if a dollar sign $ is in a cell? MollyDavis Microsoft Excel Worksheet Functions 4 17th Apr 2004 11:45 PM
USB Gamepads un-detect, or never detect in XP Pro =?Utf-8?B?RkZYSWFkZGljdA==?= Windows XP Games 1 18th Jan 2004 05:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:43 AM.