如何在窗口验证中为用户设置密码 [英] How to set password for user in Window Authentication
本文介绍了如何在窗口验证中为用户设置密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友,
我已经在asp.net中阅读了有关窗口身份验证的信息,基本上它可以与IIS级别的身份验证一起使用.
当用户请求发送到IIS时,将提示他们输入用户名和密码.
我对此有疑问
Hello Friends,
I have read about window authetication in asp.net, basically it works with IIS level of Authentication.
When users request is send to the IIS, they are prompted for username and password.
I have quries about it
Where do we set username and password?<br />
其他要点是最值得欢迎和感谢的:)
在此先感谢
Any other points is most welcome and thankful :)
Thanks in advance
推荐答案
在代码项目中,这是对Windows身份验证的很好解释.
看看
1. Windows身份验证 [ ^ ]
另请参阅
1. http://www.asp.net/mvc/tutorials/older-versions/security/authenticating-users-with-windows-authentication-vb [ http://msdn.microsoft.com/en-us/library/ff647405.aspx [ ^ ]
希望本文能够清除您的视图
Here Is Good Explanation Of Windows Authentication In Code Project.
Have A Look
1. Windows Authentication[^]
Also Refer
1. http://www.asp.net/mvc/tutorials/older-versions/security/authenticating-users-with-windows-authentication-vb[^]
2. http://msdn.microsoft.com/en-us/library/ff647405.aspx[^]
Hope This Articles Will Clear Your Views
使用.NET System框架提供的WindowsPrincipal和WindowsIdentity类,您可以验证用户名,如下所示:
Using WindowsPrincipal and WindowsIdentity class provided by .NET System framework, you can validate the username as below:
using System.Security.Principal;
using System.DirectoryServices;
private Boolean AuthenticateWindowsID(String username)
{
WindowsIdentity ident = WindowsIdentity.GetCurrent();
WindowsPrincipal user = new WindowsPrincipal(ident);
using (DirectoryEntry de = new DirectoryEntry("LDAP://" + StripDomain(user.Identity.Name)))
{
using (DirectorySearcher adSearch = new DirectorySearcher(de))
{
adSearch.Filter = "(FirmAccountName=" + username + ")";
SearchResult adSearchResult = adSearch.FindOne();
if (adSearchResult != null)
return true;
}
}
return false;
}
这篇关于如何在窗口验证中为用户设置密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文