I have a MVC application in C#. I need it to prompt the default browser authentication login popup as below image.
Then the application supposed to validate it with the Active Directory and get some other information regarding the user from the AD.
I have no issue in validating and getting the user information from AD if I have the username.
So my question is how can I make the browser prompt such modal dialog and how can I access the user's input to validate it with my AD?
Here is what I have so far. The code will only get the username from the logon user and won't prompt the pop up:
private string GetUsernameFromLogon()
{
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
int index = userName.LastIndexOf("\\");
if (index > 0)
return userName.Substring(index+1);
else
return null;
}