Alright...no takers on my last post so I'll rephrase my question. I need to build an app in VB .Net that requires a login. It would be nice if I could use the windows credentials. Failing that, encryption could also be used. Surely someone has coded this before. I am not interested in ASP.Net, but that is the only information I can locate. If no one has any sample code, could I at least be pointed to a better reference for this than MSDN and Google?
Thanks in advance!
02-18-2005, 01:01 PM
pappleby
There are a couple of important interfaces you need to look at, IIdentity and IPrincipal. A windows form aplication can get access to a couple of objects (WindowsIdentity & WindowsPrincipal) that you can use to determine if the current user of the app has been authenticated, if so who they are and also through the Pricipal object you can verify group membership. You may find this will give you what you need without writing a logon screen at all. You can check the user is authenticated, check what roles the user has (group membership) and only continue if your requirements are satisfied.
If you decide to authenticate against some other source you still may want to use the IIdentity and IPricipal interfaces.
You may be able to perform a bind to Active Directory using Windows credentials and the System.DirectoryServices namespace. There is an example in the following MS KB article: