Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I validate user credentials of windows through my application? I just need to validate that the user is providing valid username and password.This user name and password should be his log in credentials of windows for particular domain.Thanks in advance.
Posted
Updated 5-Jun-13 19:28pm
v2
Comments
Sergey Alexandrovich Kryukov 6-Jun-13 1:32am    
The question as it is formulated in its title and the body of it are actually two essentially different questions. So, could you clarify on that?
—SA
Member 9796765 6-Jun-13 3:14am    
Suppose user is logged in with username "abc" and i want my application to authenticate user "PQR" when user "abc" is logged in.
Sergey Alexandrovich Kryukov 6-Jun-13 10:22am    
We are getting to it. OK, let me ask more exactly: abc is not going to log out, the Windows session is the same. Some person, who did or did not log in on Windows, logs in for some application of yours. This person knows her/his authentication as PQR and password, both the same as would be used for Windows authentication. Your application should be able to check it up using Windows authentication. Is this the scenario? Should it check up domain authentication or local machine? Anyway...

As I can see, Solution 1 gives you an authentication check for a local computer an a specified domain. Is it all you want?

—SA
Member 9796765 7-Jun-13 5:28am    
hey LogonUser worked.I was using wrong parameter thats why not getting what i needed thanks a lot......
Sergey Alexandrovich Kryukov 7-Jun-13 9:58am    
Thank you for the feedback; please add a comment to the solution, so Andrew could get a notification.
Cheers,
—SA

1 solution

You need to use LogonUser[^] function. It is very easy to use with a minimum parameters. It can be used for a domain user
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 6-Jun-13 10:32am    
This is only for checking up with local machine authentication; and we don't know what kind of authentication OP needs. Anyway, if local machine authentication is enough, This is the solution, it looks like, my 5.
—SA
JackDingler 6-Jun-13 10:37am    
It works with domain users.

I've used this to access and modify remote registry settings, for computers on a domain.
Sergey Alexandrovich Kryukov 6-Jun-13 10:46am    
Oh, I see. As I can see now, when documentation says "to the local computer", it means that the access to the windows session cannot be remote. Indeed, one of the parameters asks the domain to log on.
Then it is a solution. Well, thank you for correcting me. Another 5.
—SA
Member 9796765 10-Jun-13 9:13am    
It worked for me thanks..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900