Greetings to all!

The user runs the program on his computer, passes domain authentication.

All his actions should be logged. At the function call log stage, an exception is thrown:

System.DirectoryServices.Protocols.DirectoryOperationException: Сервер не может обработать запросы каталогов. в System.DirectoryServices.Protocols.ErrorChecking.CheckAndSetLdapError(Int32 error) в System.DirectoryServices.Protocols.LdapSessionOptions.FastConcurrentBind() в System.DirectoryServices.AccountManagement.CredentialValidator.BindLdap(NetworkCredential creds, ContextOptions contextOptions) в System.DirectoryServices.AccountManagement.CredentialValidator.Validate(String userName, String password) в System.DirectoryServices.AccountManagement.PrincipalContext.ValidateCredentials(String userName, String password) в DV.Form1.button1_Click(Object sender, EventArgs e) в System.Windows.Forms.Control.OnClick(EventArgs e) в System.Windows.Forms.Button.OnClick(EventArgs e) в System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) в System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) в System.Windows.Forms.Control.WndProc(Message& m) в System.Windows.Forms.ButtonBase.WndProc(Message& m) в System.Windows.Forms.Button.WndProc(Message& m) в System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) в System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) в System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 

This exception is triggered only for those users who do not have local admin rights.

Checked on users with the rights of the local administrator, they have everything ok.

Attention question:

Why are the files not programmatically created, and the hands to create folders and files in Windows (through Explorer) turns out?

Also in app.manifest indicated the launch from the admin, the result is negative.

Code:

 PrincipalContext prCont = new PrincipalContext(ContextType.Domain, "kakoytodomen.ru"); string pathLog = @"C:\Users\" + SystemInformation.UserName + @"\Documents\dvlog.log"; //Путь к log файлу //Функция записи в лог (в зависимости от переданного пути). public void ToLogCommon(string text, string path) { Encoding enc = Encoding.GetEncoding(1251); try { StreamWriter f_out = new StreamWriter(@"" + path, true, enc); f_out.WriteLine(DateTime.Now.ToLocalTime() + " " + text); f_out.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } //Кнопка Enter. public void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "") { return; } else { if (prCont.ValidateCredentials(textBox1.Text.Trim(), textBox2.Text.Trim())) { if (IsUserGroupMember(textBox1.Text.Trim(), "DV_DVID")) { form2.ToLogCommon("Вход выполнен: " + textBox1.Text, form2.pathLog); form2.Show(); this.Opacity = 0; } else { form2.ToLogCommon("Данного пользователя: " + textBox1.Text.Trim() + " нет в группе DV_DVID. Доступ запрещён.\r\n", form2.pathLog); MessageBox.Show("Доступ запрещён!\r\nДанного пользователя: " + textBox1.Text.Trim() + " нет в группе DV_DVID.\r\nНеобходимо оформить заявку в СПП.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { form2.ToLogCommon("Логин или пароль введен неверно! Проверьте правильность введённых данных.\r\n", form2.pathLog); MessageBox.Show("Логин или пароль введен неверно!\r\nПроверьте правильность введённых данных.", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } 

Closed due to the fact that off-topic by participants AK , aleksandr barakin , Alexey Shimansky , Streletz , Saidolim 29 May '17 at 13:38 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - AK, aleksandr barakin, Alexey Shimansky, Streletz, Saidolim
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 2
    Your authorization option is not a domain authorization. This is just LDAP authentication. - Pavel Mayorov
  • True, but not the point. Why a user without admin rights can create files through explorer, but not programmatically? What is the problem? Why does an exception fire when a file is created? - Amir Ismylove
  • No, that's the point. Explorer uses a completely different access check mechanism. - Pavel Mayorov
  • Look carefully at which line falls - you do not have an error at the stage of creating the file. - Pavel Mayorov
  • I deleted my local admin rights, rebooted the computer =) I started, I plow everything) Miracles ... The error is not reproduced accordingly ...) - Amir Ismylove

0