Windows表单身份验证 [英] Windows Form authentication
问题描述
我想基于Single Sign On主体构建带有登录名的Windows Form应用程序.因此,我想使用相同的Windows域用户名/密码登录并显示一些开头的值.
只有我在互联网上找不到有关此主题或在codeproject上的分配.有人知道一些提示吗?
在此先感谢!
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!
推荐答案
尝试以下CodeProject文章:
WinForm应用程序的用户登录 [
Try this CodeProject article:
User Login For WinForm Applications[^]
看看约翰的文章
WinForm应用程序的用户登录 [
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
}
尝试谷歌搜索"Winforms Windows身份验证"以获取更多参考信息
Try googling ''Winforms Windows Authentication'' for more references
尝试以下链接,该链接可帮助您了解ASP.NET应用程序在其下运行的用户.
http://webnetrevolution.blogspot.com/2011/04/windowsidentitygetcurrentname-in-aspnet.html [ ^ ]
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[^]
这篇关于Windows表单身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!