LdapFilterEncode

发布时间 2023-10-16 10:17:29作者: ChuckLu
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)