.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> C# >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Password Masking in Console.Applications

Posted By:Hefin Dsouza       Posted Date: August 15, 2009    Points: 25    Category: C#    URL: http://www.dotnetspark.com  
 

Ever Wondered how to add Password Masking in Console Applications.
Here is the solution


ConsoleKeyInfo key;

string pass = "";

do

{

key = Console.ReadKey(true);

if (key.Key != ConsoleKey.Backspace) // Backspace Should Not Work

{

pass += key.KeyChar;

Console.Write("*");

}

} while (key.Key != ConsoleKey.Enter);

Console.WriteLine();

Console.WriteLine(pass);


Regards
Hefin Dsouza
 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend