如何在窗口验证中为用户设置密码

编程入门 行业动态 更新时间:2024-10-28 02:22:16
本文介绍了如何在窗口验证中为用户设置密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好朋友, 我已经在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; }

更多推荐

如何在窗口验证中为用户设置密码

本文发布于:2023-10-20 01:03:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1509365.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中为   窗口   密码   用户   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!