aplogic
asked on
WinForms: Windows Authentication
Hello, I'm creating a few winform applications that will integrate with my company's webform intranet. The webforms use Windows authentication, so employees only have to use their IIS login. I wish to do the same for the winforms but I haven't been able to find anything on the internet explaining how to do this. Yes, it is a little redundant since the user is already logged into the machine, but I just want to verify that it is that user running the application. So is there any way to use windows authentication in a winform?
Thanks,
Christion
Thanks,
Christion
try using the WindowsIdentity class
Dim theIdentity As WindowsIdentity = WindowsIdentity.GetCurrent ()
Dim thePrincipal As New WindowsPrincipal(theIdenti ty)
If thePrincipal.Identity.IsAu thenticate d Then
<tasks>
End if
you have to import the namespace Principal:
Imports System.Security.Principal
Dim theIdentity As WindowsIdentity = WindowsIdentity.GetCurrent
Dim thePrincipal As New WindowsPrincipal(theIdenti
If thePrincipal.Identity.IsAu
<tasks>
End if
you have to import the namespace Principal:
Imports System.Security.Principal
ASKER
Hmm... that checks to see if the person is logged into the computer (and you can also then check roles, etc).
But I want to verify that the person opening my program is the same person logged into the computer. So I want to ask them their windows username and password again (basically like windows authentication for web forms).
But I want to verify that the person opening my program is the same person logged into the computer. So I want to ask them their windows username and password again (basically like windows authentication for web forms).
then u can pull the user name from WindowsPrincipal and compare with the user input:
If thePrincipal.Identity.Name =TextBox1. Tex Then
<tasks>
End if
If thePrincipal.Identity.Name
<tasks>
End if
ASKER
What about the password- how do I verify that they put in their correct Windows password?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That was exactly what I was looking for.
Thanks!
Christion
Thanks!
Christion
ASKER