Click here to Skip to main content
15,897,151 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I would like to build a Windows Form application with login, based on Single Sign On principals. So I want to use my same Windows Domain username/password to login and shows some value to start with.

Only I can't find allot on the internet about this topic or on codeproject. Does anyone got some tips?

Thanks in advance!
Posted

Try this CodeProject article:

User Login For WinForm Applications[^]
 
Share this answer
 
Have a look at John's article

User Login For WinForm Applications[^]

Basically, the magic is in these lines

WindowsIdentity  identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);


That will get you the current logged on user. You can then test for group membership and grant or deny access to resource based on membership

WindowsIdentity  identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);
if (principal.IsInRole("Administrator")
{
    // Grant access to some Admin resource
}


Try googling 'Winforms Windows Authentication' for more references
 
Share this answer
 
Try below link which help you know the user under which your ASP.NET application is running.

http://webnetrevolution.blogspot.com/2011/04/windowsidentitygetcurrentname-in-aspnet.html[^]
 
Share this answer
 

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