在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
using System.Runtime.InteropServices; protected bool fun_AuthDomainUser(string username, string domain, string passwd) { const int LOGON32_LOGON_INTERACTIVE = 2; //通过网络验证账户合法性 const int LOGON32_PROVIDER_DEFAULT = 0; //使用默认的Windows 2000/NT NTLM验证方 IntPtr tokenHandle = new IntPtr(0); tokenHandle = IntPtr.Zero; bool checkok = LogonUser(username, domain, passwd, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, ref tokenHandle); return checkok; } [DllImport("advapi32.dll")] private static extern bool LogonUser(string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); |
请发表评论