示例#1
0
 public void Dispose()
 {
     if (impersonator != null)
     {
         impersonator.Dispose();
         impersonator = null;
     }
 }
 public void Dispose()
 {
     if (impersonator != null)
     {
         impersonator.Dispose();
         impersonator = null;
     }
 }
 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;
         }
     }
 }
 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;
                }
            }
        }