I have a custom usercontrol to logon users.
My Authentication setting:
Authentication Type: Windows
Enabled anonymous access
IIS Authentication Setting: Basic authentication
Now is the question how I can logon an anonymous user when he type a username + password and click login in the custom user control?
My current code in a IHttpModul:
IntPtr token = IntPtr.Zero;
bool result = User.LogonUser(userName,
host,
userPassword,
User.LogonSessionType.NetworkCleartext,
User.LogonProvider.Default,
out token);
if (result)
{
WindowsIdentity identity = new WindowsIdentity(token, "Basic");
WindowsPrincipal principal = new WindowsPrincipal(identity);
HttpContext.Current.User = principal;
}
But I get a login windows from internet explorer.
But the strang thing is when I click on the cancel button I am loged in into SharePoint!
Any suggestions?