Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
ok... so here is my situation.. I need to login into windows XP using a smart card when windows start...

I have read the CSN (UID) of the card even from the login (windows authentication) screen successfully... I was having trouble using event handlers in service so i went for windows app instead and its quite working even before login.. coz i setup the .exe as a script on startup

Now im stuck on how to physically login to windows.. I have hardcoded the username and password in my code so there is no issue about that.. and yes I need to do it like this..

Please help me how to achieve this.. or an easy alternative...

thanks in advence!
Posted

If you're talking about having your Windows Forms application do the console login for the user, you can't. This is a security violation.

The application can log into Windows as a user, but only if your app was setup as a Windows Service and the account you specify has the "Logon as service" permission. This will NOT log the console in for the user.
 
Share this answer
 
Comments
umarbangash 15-Mar-13 16:15pm    
I just want to swipe my card and do windows shud log in... Cant there be a simple way to do so??

using the logon methods can log me in in other session but i want the screen to change and log in.. instead of staying there at the windows login screen!
No, it's FAR from simple.

If you want to do this on Windows XP, you'll have to replace the GINA with your own. You're NOT going to write a new one in C#.

On Windows Vista and above, the security model has been completely overhauled, so the same code won't work on Vista and above.

Seeing as Windows XP support is competely dead as of April 2014, I wouldn't waste your time with it.

There is no way to get your existing code to do what you want. You better read
this[^] to see what you're in for.
 
Share this answer
 
Comments
umarbangash 16-Mar-13 6:28am    
I greatly appreciate ur help... so kind of u.. But do i have to do the same GINA thing for windows7 aswell??
Dave Kreskowiak 16-Mar-13 10:34am    
You'd be creating a custom Credential Provider. Again, you're NOT doing this in C#. You can read more about it at these links: http://msmvps.com/blogs/alunj/archive/2011/02/21/1788561.aspx
http://msdn.microsoft.com/en-us/magazine/cc163489.asp
http://msdn.microsoft.com/en-us/library/bb776042(v=vs.85).aspx

There is a Credential Provider Technical Reference doc at: http://archive.msdn.microsoft.com/ShellRevealed/Release/ProjectReleases.aspx?ReleaseId=2871

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