コード例 #1
0
 public void Dispose()
 {
     if (impersonator != null)
     {
         impersonator.Dispose();
         impersonator = null;
     }
 }
コード例 #2
0
 public void Dispose()
 {
     if (impersonator != null)
     {
         impersonator.Dispose();
         impersonator = null;
     }
 }
コード例 #3
0
 public NetworkShareImpersonator(bool impersonate)
 {
     string username = Configuration.Services.NetworkImpersonation.Username;
     string password = Configuration.Services.NetworkImpersonation.GetPassword();
     if (impersonate && Configuration.Services.NetworkImpersonation.IsEnabled())
     {
         try
         {
             impersonator = new Impersonator(Configuration.Services.NetworkImpersonation.Domain, username, password);
         }
         catch (Exception e)
         {
             Log.Warn("Failed to impersonate {0} -> {1}", username, e.Message);
             impersonator = null;
         }
     }
 }
コード例 #4
0
 public NetworkShareImpersonator(bool impersonate)
 {
     string username = Configuration.Services.NetworkImpersonation.Username;
     string password = Configuration.Services.NetworkImpersonation.GetPassword();
     if (impersonate && !String.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
     {
         try
         {
             impersonator = new Impersonator(Configuration.Services.NetworkImpersonation.Domain, username, password);
         }
         catch (Exception)
         {
             Log.Warn("Failed to impersonate {0}", username);
             impersonator = null;
         }
     }
 }
コード例 #5
0
        public NetworkShareImpersonator(bool impersonate)
        {
            string username = Configuration.Services.NetworkImpersonation.Username;
            string password = Configuration.Services.NetworkImpersonation.GetPassword();

            if (impersonate && !String.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
            {
                try
                {
                    impersonator = new Impersonator(Configuration.Services.NetworkImpersonation.Domain, username, password);
                }
                catch (Exception)
                {
                    Log.Warn("Failed to impersonate {0}", username);
                    impersonator = null;
                }
            }
        }