From: http://weblogs.3322.org/
The current program requires that the Asp.net program can use existing domain users to log on (and be sure to use forms to log on in order to be consistent with other program interfaces ), you can find some relevant information and find it.
Mainly depends onThe logonuser API function in advapi32.dll.
Using system. Web. Security;
Using system. runtime. interopservices;
[Dllimport ("advapi32.dll", charset = charset. Auto)]
Public static extern int logonuser (string lpszusername,
String lpszdomain,
String lpszpassword,
Int dwlogontype,
Int dwlogonprovider,
Ref intptr phtoken );
Public const int logon32_logon_interactive = 2;
Public const int logon32_provider_default = 0;
Void login_click (Object sender, eventargs E)
{
Intptr token = intptr. zero;
If (logonuser (username. value,
Userdomain. value,
Userpass. value,
Logon32_logon_interactive,
Logon32_provider_default,
Ref token )! = 0)
{
Formsauthentication. redirectfromloginpage (username. value,
Persistcookie. Checked );
}
Else
{
Lblresults. Text = "invalid credentials: Please try again ";
}
}
Other aspects of use are not much different from common forms programs, and there may be better methods.
Note: technology consistency