mask password in c# console application?

  • Thread starter Thread starter Yang
  • Start date Start date
Y

Yang

Hi
Is it possible to mask console input in a c# console application?
What I mean is: if I entered string "test" in the console, it'll echo
"****"(or nothing) instead of the string "test".

I've tried setting the foregroud color of the console the same as the
backgroud color through native API, but it doesn't really hide the password,
actually, users can manually change the foregroud color in a windows console
window, or they can copy the password from the right place of the screen
directly even they do not 'see' it. Is there a better way to do it?

thanks
Yang Liu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top