本文介绍了如何在窗口验证中为用户设置密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友, 我已经在asp中阅读了有关窗口身份验证的信息,基本上它可以与IIS级别的身份验证一起使用. 当用户请求发送到IIS时,将提示他们输入用户名和密码. 我对此有疑问
Hello Friends, I have read about window authetication in asp, 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. www.asp/mvc/tutorials/older-versions/security/authenticating-users-with-windows-authentication-vb [ ^ ] 2. msdn.microsoft/en-us/library/ff647405.aspx [ ^ ] 希望本文能够清除您的视图 Here Is Good Explanation Of Windows Authentication In Code Project. Have A Look 1. Windows Authentication[^] Also Refer 1. www.asp/mvc/tutorials/older-versions/security/authenticating-users-with-windows-authentication-vb[^] 2. msdn.microsoft/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; }
更多推荐
如何在窗口验证中为用户设置密码
发布评论