0

I am trying to find a certificate from store using its Thumbprint. I am having very hard time to find what is the problem with my code. See the image

Top section shows my code with debugger stopped at that position. Then I have copied that statement into Immediate Window and the count is zero.

There are two certificates in the location that I am trying to find and second certificate is what i am interested in. So I have modified the statement to use the thumbprint of that certificate rather than typing it manually in. Now the count is 1.

Then I just printed Thumbprint and copied to previous statement and count is 1. So I thought there is a typo. but I you see the last two statements, there is no typo. only difference is spaces, which does not matter. But I tried making both statements look exactly same but result always differ.

Not sure what is going on... either i am missing very simple thing or i am too stupid.

user3731783
  • 718
  • 1
  • 7
  • 31

1 Answers1

2

Your original string might contain invisible Unicode characters. If the thumbprint string from Certificate[1].Thumbprint works fine, copy it from debug window and use that one instead.

tia
  • 9,518
  • 1
  • 30
  • 44
  • i have this problem again. Previously i was able to solve it by copying from debugger but I cannot do that for prod deployment. Copying the thumbprint to notepad also did not help. Any other suggestions? – user3731783 Aug 26 '15 at 17:10
  • 1
    this one helped http://stackoverflow.com/questions/11115511/how-to-find-certificate-by-its-thumbprint-in-c-sharp – user3731783 Aug 26 '15 at 17:28