public void Dispose()
 {
     if (impersonator != null)
     {
         impersonator.Dispose();
         impersonator = null;
     }
 }
 public void Dispose()
 {
     if (impersonator != null)
     {
         impersonator.Dispose();
         impersonator = null;
     }
 }
 public ImpersonationContext()
 {
     string username = Configuration.Services.NetworkImpersonation.Username;
     try
     {
         impersonator = new Impersonator(Configuration.Services.NetworkImpersonation.Domain, username, Configuration.Services.NetworkImpersonation.GetPassword());
     }
     catch (Exception e)
     {
         Log.Error(String.Format("Failed to impersonate {0}", username), e);
         impersonator = null;
     }
 }
        public ImpersonationContext()
        {
            string username = Configuration.Services.NetworkImpersonation.Username;

            try
            {
                impersonator = new Impersonator(Configuration.Services.NetworkImpersonation.Domain, username, Configuration.Services.NetworkImpersonation.GetPassword());
            }
            catch (Exception e)
            {
                Log.Error(String.Format("Failed to impersonate {0}", username), e);
                impersonator = null;
            }
        }