示例#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 && !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;
         }
     }
 }
示例#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;
                }
            }
        }