S
SharpCoderMP
hi,
i'm writing a console application and i would like to be able to safely
retrive password from the user, so noone can see how it is being typed.
consider this scenario:
Console.Write("Enter password:");
string pass = Console.ReadLine()
when this is called and user types, his passsword is displayed on the
screen. i would like to avoid that, and do not print any characters or
eventually print only '*' char for each user typed char. i thought i
could use Console.Read() in a loop, but i can't make it work the way i
want. it seems that Console.Read() works almost the same as
Console.ReadLine() - it waits until user types what he needs and hits
[enter] and then starts reading char by char.
i know i'm missing something...
i'm writing a console application and i would like to be able to safely
retrive password from the user, so noone can see how it is being typed.
consider this scenario:
Console.Write("Enter password:");
string pass = Console.ReadLine()
when this is called and user types, his passsword is displayed on the
screen. i would like to avoid that, and do not print any characters or
eventually print only '*' char for each user typed char. i thought i
could use Console.Read() in a loop, but i can't make it work the way i
want. it seems that Console.Read() works almost the same as
Console.ReadLine() - it waits until user types what he needs and hits
[enter] and then starts reading char by char.
i know i'm missing something...