首页 > 其他分享 >LdapFilterEncode

LdapFilterEncode

时间:2023-10-16 10:24:01浏览次数:36  
标签:UserName LdapFilterEncode sAMAccountName Encoder Nuget was

LdapFilterEncode

                   var sAMAccountName =                         Microsoft.Security.Application.Encoder.LdapFilterEncode(username);                     searcher.Filter = string.Format("(sAMAccountName={0})", sAMAccountName);  

c# - LDAP Filter Encoder Replacement - Stack Overflow

I was looking for the answer to this and came across your question. I found it here, it has been moved to a Nuget package here: https://www.nuget.org/packages/AntiXSS/ and taken out of the core framework.

According to this blog post: https://archive.codeplex.com/?p=wpl the project will continue to be updated with security updates, however the last time it was updated on Nuget was 2014.

I installed the package, the namespace you need is still:

Microsoft.Security.Application.Encoder.LdapFilterEncode(value)
 

参数化sql

 string query = $@"SELECT [Id], [EmailAddress], [DisplayName], [UserName] FROM {userTable} " +                     "WHERE UserName = @UserName";                 using (SqlCommand cmd = new SqlCommand(query))                 {                     cmd.Connection = connection;                     connection.Open();      

标签:UserName,LdapFilterEncode,sAMAccountName,Encoder,Nuget,was
From: https://www.cnblogs.com/chucklu/p/17766785.html

相关文章