Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 11-12-2008, 02:51 PM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default Windows Authentication for desktop Application


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 by garv84; 12-12-2008 at 02:47 PM. Reason: Automerged Doublepost
garv84 is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 11-12-2008, 06:19 PM   #2 (permalink)
Legen-wait for it-dary!
 
dheeraj_kumar's Avatar
 
Join Date: Dec 2004
Location: Chennai
Posts: 2,471
Default Re: Windows Authentication for desktop Application

http://msdn.microsoft.com/en-us/libr...31(VS.85).aspx

check out the topic "credentials"
__________________
If the Start Windows Restart when Windows starts check box is checked Windows Restart will start automatically every time Windows is started. - Actual excerpt from a windows program help file
dheeraj_kumar is offline  
Old 11-12-2008, 09:08 PM   #3 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default Re: Windows Authentication for desktop Application

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.
garv84 is offline  
Old 12-12-2008, 02:42 AM   #4 (permalink)
Legen-wait for it-dary!
 
dheeraj_kumar's Avatar
 
Join Date: Dec 2004
Location: Chennai
Posts: 2,471
Default Re: Windows Authentication for desktop Application

http://www.developerfusion.com/code/...anagement-api/
http://www.google.com/search?client=...utf-8&oe=utf-8
__________________
If the Start Windows Restart when Windows starts check box is checked Windows Restart will start automatically every time Windows is started. - Actual excerpt from a windows program help file
dheeraj_kumar is offline  
Old 12-12-2008, 11:02 AM   #5 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default Re: Windows Authentication for desktop Application

Thanks for the links Dheeraj..!!

with ref to the link :

http://www.developerfusion.com/code/...agement-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 by garv84; 12-12-2008 at 11:06 AM. Reason: Automerged Doublepost
garv84 is offline  
Old 12-12-2008, 03:24 PM   #6 (permalink)
Legen-wait for it-dary!
 
dheeraj_kumar's Avatar
 
Join Date: Dec 2004
Location: Chennai
Posts: 2,471
Default Re: Windows Authentication for desktop Application

You have to write it on your own, I think.
__________________
If the Start Windows Restart when Windows starts check box is checked Windows Restart will start automatically every time Windows is started. - Actual excerpt from a windows program help file
dheeraj_kumar is offline  
Old 12-12-2008, 06:30 PM   #7 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default Re: Windows Authentication for desktop Application

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..?
garv84 is offline  
Old 14-12-2008, 01:40 AM   #8 (permalink)
Legen-wait for it-dary!
 
dheeraj_kumar's Avatar
 
Join Date: Dec 2004
Location: Chennai
Posts: 2,471
Default Re: Windows Authentication for desktop Application

Hmm... Is the credentials and the loginapi different stuff? Anyway, what exactly do you want to do? Perhaps we can find another way.
__________________
If the Start Windows Restart when Windows starts check box is checked Windows Restart will start automatically every time Windows is started. - Actual excerpt from a windows program help file
dheeraj_kumar is offline  
Old 15-12-2008, 02:22 PM   #9 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default Re: Windows Authentication for desktop Application

Quote:
Originally Posted by dheeraj_kumar View Post
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.
garv84 is offline  
Old 15-12-2008, 04:46 PM   #10 (permalink)
Legen-wait for it-dary!
 
dheeraj_kumar's Avatar
 
Join Date: Dec 2004
Location: Chennai
Posts: 2,471
Default Re: Windows Authentication for desktop Application

Gotcha!

http://blog.excastle.com/2004/11/05/...ssword-dialog/
http://groups.google.com/group/micro...793cda1bee7c7f

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
__________________
If the Start Windows Restart when Windows starts check box is checked Windows Restart will start automatically every time Windows is started. - Actual excerpt from a windows program help file
dheeraj_kumar is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows application on your Ubuntu desktop bajaj151 Tutorials 1 15-08-2007 11:25 AM
VISTA TUTORIAL: Add Your Favorite Application Shortcut in Desktop Context Menu Vishal Gupta Tutorials 19 28-05-2007 02:32 AM
IIS [problem with authentication]! coolazeem Software Q&A 1 20-01-2006 01:27 AM
smtp without authentication akshar QnA (read only) 4 10-01-2006 04:10 PM
WINDOWS XP & AUTHENTICATION Nariman Software Q&A 5 09-07-2005 07:21 PM

 
Latest Threads
- by gforz
- by soumya
- by Sujeet
- by icebags
- by Charan

Advertisement




All times are GMT +5.5. The time now is 03:02 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2