Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows .NET smartcard
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 8:58am
Rate this: bad
good
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.
  Permalink  
Comments
umarbangash at 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
good
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.
  Permalink  
Comments
umarbangash at 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 at 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)

  Print Answers RSS
0 Maciej Los 295
1 OriginalGriff 273
2 Aajmot Sk 234
3 Marcin Kozub 205
4 Richard MacCutchan 200
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,127
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 15 Mar 2013
Copyright © CodeProject, 1999-2014
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