Windows Authentication for desktop Application

Status
Not open for further replies.

garv84

Broken In
Hello everyone.I have a VS 2005 (C#) windows application.when i run the application i want to authenticate the current login username and password with possibly the windows LoginAPI.can any one help me with a C# code.

Multiple users will be using the same desktop to login to my .Net application. I don't want to force the users to log out of the desktop everytime there is a new user, as this will take a long time to relogin to windows.



Here is what I'm looking to do (Preferably in C# and NO web services):

Presente the user with a form to enter their username and password
Authenticate these users against a windows XP
Use the Authentication token returned from Windows XP for verification and validation.


Assumptions:

the users will have separate accounts setup on Windows XP.

Can neone suggest how to use the PromptForCredentials class to validate the user and prompt the PromptForCredentials dialog ..i have gone thro the msdn but its not clear actaully.Can neone tell me the namespace to be used.
 
Last edited:
OP
G

garv84

Broken In
I have created the CredenialsDialog.cs class file taking help from Msdn.on form load i am calling a Login() method which prompts the Credentials dialog prompt.that method needs to authenticate the system username and password.I need that method implementation. private static bool Authenticate(string name, string password) {... }C# code.
 

dheeraj_kumar

Legen-wait for it-dary!
*www.developerfusion.com/code/4693/using-the-credential-management-api/
*www.google.com/search?client=opera...+api&sourceid=opera&num=100&ie=utf-8&oe=utf-8
 
OP
G

garv84

Broken In
Thanks for the links Dheeraj..!!

with ref to the link :

*www.developerfusion.com/code/4693/using-the-credential-management-api/2/


the Authentication via the loginAPI should be an internal process or i will have to write the code for authenticating the username and passowrd in the API that is provided by the windows users..

Code:
private static bool Authenticate(string name, string password)
{
// return true if the authentication succeeds
}

what will be the authntication code..?
 
Last edited:
OP
G

garv84

Broken In
Thats were the problem lies.If we were to write the autehntication method ourselves why on earth will we require the Windows "LoginAPI"..we could have implemented a simple form with two textboxes and two buttons.So whats the use..?
 

dheeraj_kumar

Legen-wait for it-dary!
Hmm... Is the credentials and the loginapi different stuff? Anyway, what exactly do you want to do? Perhaps we can find another way.
 
OP
G

garv84

Broken In
Hmm... Is the credentials and the loginapi different stuff? Anyway, what exactly do you want to do? Perhaps we can find another way.

As i told Dheeraj !! I have a Visual studio windows application.When i run the application i want a Username_password login Pop_up which will "Windows authenticate" the users.I mean to say that multiple users of the system can access the application without switching/logging off from the present user account(XP)

Is thre ne other way..?

Appreciating all your helps.
Thanks.
 

dheeraj_kumar

Legen-wait for it-dary!
Gotcha!

*blog.excastle.com/2004/11/05/api-magic-windows-password-dialog/
*groups.google.com/group/microsoft....ecurity/browse_thread/thread/ec793cda1bee7c7f

First link if you want to display the default windows password dialog, or just make your own if you feel thats complicated.
Second link has the stuff required to log-in to the comp.

Note that you need extensive reference with pinvoke.net as cred functions look awful :)

Hav fun :)
 
Status
Not open for further replies.
Top Bottom