當前位置: 首頁>>代碼示例>>C#>>正文


C# WindowsImpersonationContext.Undo方法代碼示例

本文整理匯總了C#中System.Security.Principal.WindowsImpersonationContext.Undo方法的典型用法代碼示例。如果您正苦於以下問題:C# WindowsImpersonationContext.Undo方法的具體用法?C# WindowsImpersonationContext.Undo怎麽用?C# WindowsImpersonationContext.Undo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Security.Principal.WindowsImpersonationContext的用法示例。


在下文中一共展示了WindowsImpersonationContext.Undo方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RevertToImpersonatedUser

 public static void RevertToImpersonatedUser(WindowsImpersonationContext _serviceAccountContext)
 {
     if (_serviceAccountContext != null)
     {
         _serviceAccountContext.Undo();
     }
 }
開發者ID:k2workflow,項目名稱:K2Field.Helpers,代碼行數:7,代碼來源:WindowsPrincipalHelper.cs

示例2: EndImpersonation

        /// <summary>
        /// Ends the impersonation of the specified user.
        /// </summary>
        /// <param name="impersonatedUser"><see cref="WindowsImpersonationContext"/> of the impersonated user.</param>
        /// <example>
        /// This example shows how to terminate an active user impersonation:
        /// <code>
        /// using System;
        /// using System.IO;
        /// using System.Security.Principal;
        /// using PCS.Identity;
        ///
        /// class Program
        /// {
        ///     static void Main(string[] args)
        ///     {
        ///         // Impersonate user.
        ///         WindowsImpersonationContext context = UserInfo.ImpersonateUser("XYZCorp", "johndoe", "password");
        ///         // Perform operation requiring elevated previleges.
        ///         Console.WriteLine(File.ReadAllText(@"\\server\share\file.xml"));
        ///         // End the impersonation.
        ///         UserInfo.EndImpersonation(context);
        ///
        ///         Console.ReadLine();
        ///     }
        /// }
        /// </code>
        /// </example>
        public static void EndImpersonation(WindowsImpersonationContext impersonatedUser)
        {
            if (impersonatedUser != null)
            {
                impersonatedUser.Undo();
                impersonatedUser.Dispose();
            }

            impersonatedUser = null;
        }
開發者ID:avs009,項目名稱:gsf,代碼行數:38,代碼來源:UserInfo.cs

示例3: deshacerImpersonation

		public static void deshacerImpersonation(WindowsImpersonationContext impersonationContext)
		{
			impersonationContext.Undo();
		}
開發者ID:pjeconde,項目名稱:CedForecast,代碼行數:4,代碼來源:Funciones.cs

示例4: StopImpersonateUser

 /// <summary>
 /// Stops impersonating authorized user.
 /// </summary>
 /// <param name="user"></param>
 public static void StopImpersonateUser(WindowsImpersonationContext user)
 {
     user.Undo();
 }
開發者ID:vinhdoan,項目名稱:Angroup.demo,代碼行數:8,代碼來源:ServiceView.cs

示例5: ReImpersonate

 internal static void ReImpersonate(WindowsImpersonationContext impersonation){
     impersonation.Undo();
 }
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:3,代碼來源:Executor.cs

示例6: Log_off

        static public void Log_off(WindowsImpersonationContext wic)
        {
            wic.Undo();

        }
開發者ID:wra222,項目名稱:testgit,代碼行數:5,代碼來源:Logon.cs

示例7: RevertImpersonation

 /// <summary>
 /// Releases an impersonation context and releases associated resources
 /// </summary>
 /// <param name="context">WindowsImpersonation context created with ImpersonateUser</param>
 public static void RevertImpersonation(WindowsImpersonationContext context)
 {
     context.Undo();
     context.Dispose();
 }
開發者ID:CocoaLab,項目名稱:WestwindToolkit,代碼行數:9,代碼來源:SecurityUtils.cs


注:本文中的System.Security.Principal.WindowsImpersonationContext.Undo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。