سلام بر برنامه نویسان عزیز با یه کد سی شارپ دیگه در خدمتتون هستم.امیدوارم که از این استفاده کافی رو ببرید.
با استفاده از کدی که برای شما در چندخط پایین تر قرار داده ام ، می تونید چک کنید یوزر وجود داره یا روی دایرکتوری داده شده نیست.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
using System.DirectoryServices.ActiveDirectory;
using System.DirectoryServices.Protocols;
using System.Net;
namespace ADCheck
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
LdapConnection connection = new LdapConnection(txtad.Text);
NetworkCredential credential = new NetworkCredential(txtusername.Text, txtpassword.Text);
connection.Credential = credential;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
using System.DirectoryServices.ActiveDirectory;
using System.DirectoryServices.Protocols;
using System.Net;
namespace ADCheck
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
LdapConnection connection = new LdapConnection(txtad.Text);
NetworkCredential credential = new NetworkCredential(txtusername.Text, txtpassword.Text);
connection.Credential = credential;