Caret character problem in Console Application

Glenn Sarsonas 1 Reputation point
2021-07-11T05:24:47.367+00:00

Hi! I'm having a little trouble with the caret (^) character.

I'm creating a vb.net console application to verify an AD user.

Imports System.DirectoryServices.AccountManagement  
Module Module1  
  
    Sub Main(ByVal args() As String)  
  
        Dim isWithAD As Boolean  
  
        Try  
  
            Dim pc As PrincipalContext = New PrincipalContext(ContextType.Domain, "<AD Domain Here>")  
            Using (pc)  
                isWithAD = pc.ValidateCredentials(args(0), args(1))  
            End Using![113447-ldap.png][1]  
  
            Console.WriteLine(IIf(isWithAD = True, "Success", "Failed"))  
  
        Catch ex As Exception  
  
            Console.WriteLine("Error [" + ex.ToString + "] - " + ex.InnerException.ToString)  
  
        End Try  
  
    End Sub  
  
End Module  

The problem is when the password has a caret character at the end (E.g. zpfrt^), it returns a FALSE value. Even I tried to enclosed it in [], (), "", and {}, it doesn't solve the problem. I also tried this one - ^^^^, it still not working.

Do you have any idea how to fix this?

Please let me know if you have a solution. Thanks in advance guys :)

Example:

113460-ldap.png

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,622 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Glenn Sarsonas 1 Reputation point
    2021-07-11T11:17:39.473+00:00

    Need a little help. Pls? thanks ^_^

    0 comments No comments

  2. Hannah Xiong 6,276 Reputation points
    2021-07-12T05:03:23.537+00:00

    Hello @Glenn Sarsonas ,

    Thank you so much for posting here.

    So sorry that I am not professional with this issue. Hope someone could share their knowledge or experience here. If there is still no progress, I would suggest that we could contact Microsoft Customer Services and Support to get an efficient solution:

    https://support.serviceshub.microsoft.com/supportforbusiness

    Thanks for your understanding and support.

    Best regards,
    Hannah Xiong

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.