还是关于AD验证的问题...
前段时间问过大家AD验证问题,我在网上查到不少资料,MSDN中对AD验证这一部分说的很详细,我也有参考的做过,但效果不是很理想,没有实现我预想的效果,我想我问问大家用LOGON32_LOGON_API能不能实现AD验证这个功能? const int LOGON32_LOGON_INTERACTIVE = 2;
const int LOGON32_LOGON_NETWORK = 3;
const int LOGON32_LOGON_BATCH = 4;
const int LOGON32_LOGON_SERVICE = 5;
const int LOGON32_LOGON_UNLOCK = 7;
const int LOGON32_LOGON_NETWORK_CLEARTEXT = 8;
const int LOGON32_LOGON_NEW_CREDENTIALS = 9;
const int LOGON32_PROVIDER_DEFAULT = 0;
[DllImport("advapi32.dll", SetLastError = true)]
public static extern int LogonUser(
string lpszUsername,
string lpszDomain,
string lpszPassword,
int dwLogonType,
int dwLogonProvider,
out IntPtr phToken
);
[DllImport("advapi32.dll", SetLastError = true)]
public static extern int ImpersonateLoggedOnUser(
IntPtr hToken
);
[DllImport("advapi32.dll", SetLastError = true)]
static extern int RevertToSelf();
[DllImport("kernel32.dll", SetLastError = true)]
static extern int CloseHandle(IntPtr hObject);
我也有LOGON32_API来实现但是microsoft中的技术文档中,一直提示LdapAuthentication adAuth = new LdapAuthentication(adPath); 这里出错 .我参考的是 http://support.microsoft.com/kb/316748/zh-cn 不知道是我参考的文件有问题?还是原因?警告 1 声明了变量“ex”,但从未使用过 E:\AD_Try2\Global.asax 51
警告 2 “ASP.webform1_aspx.Page_Load(object, System.EventArgs)”隐藏了继承的成员“WebForm1.Page_Load(object, System.EventArgs)”。如果是有意隐藏,请使用关键字 new。 E:\AD_Try2\WebForm1.aspx 15
错误 3 找不到类型或命名空间名称“LdapAuthentication”(是否缺少 using 指令或程序集引用?) E:\AD_Try2\Login.aspx 24 3 E:\AD_Try2\
错误 4 找不到类型或命名空间名称“LdapAuthentication”(是否缺少 using 指令或程序集引用?) E:\AD_Try2\Login.aspx 24 35 E:\AD_Try2\
出现上述问题确实很头疼不知道怎么解决,望高手指点...