Click here to Skip to main content
13,086,019 members (82,844 online)
Rate this:
Please Sign up or sign in to 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 15-Mar-13 7:58am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
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!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.
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:

There is a Credential Provider Technical Reference doc at:

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 15 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100