使用C#的用户在编写的WinForm程序中,如果需要使用域账号进行认证管理一般需使用Win32API LogonUser()进行。 这里提供一段我使用的完整的验证代码,大家可以根据需要自己进行适当的修改从而实现在WinForm中。 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; // DllImport namespace WindowsApplicationTest1