473,795 Members | 2,914 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

safe "prompt for password" in console application

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.ReadLin e()

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.ReadLin e() - it waits until user types what he needs and hits
[enter] and then starts reading char by char.

i know i'm missing something...
Nov 17 '05 #1
2 6479
Check this article out. It will help you, dont know if this is the "correct"
way to do it but it does the trick.

http://www.codeproject.com/dotnet/Co...swordInput.asp

--
Best regards Björn Olsson
Head of Technology
Centre for Business Solutions
Gothenburg School of Economics and Commercial Law
"SharpCoder MP" wrote:
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.ReadLin e()

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.ReadLin e() - it waits until user types what he needs and hits
[enter] and then starts reading char by char.

i know i'm missing something...

Nov 17 '05 #2
thanks! that's exacly what i need. i was browsing codeproject but didn't
came acros this. thanks for the link... boy it looks preety twisted :P

Björn Olsson wrote:
Check this article out. It will help you, dont know if this is the "correct"
way to do it but it does the trick.

http://www.codeproject.com/dotnet/Co...swordInput.asp

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
6433
by: zhi | last post by:
Really confused, when I use keyword style argument as following: >>> input(prompt="hello") Traceback (most recent call last): File "<pyshell#52>", line 1, in -toplevel- input(prompt="hello") TypeError: input() takes no keyword arguments While the library reference says the function is: input( )
1
3344
by: twhan twhan via .NET 247 | last post by:
Hi, currently i am developing a Radius server application. Cananyone show me how can i unpack the "User-Password" attribute sothat i can get back the password in plain text so that i canverify it against my database. For example, the user entered password "testpassword". Assumethat the shared secret between the NAS and my radius server is"testshared". I am totally unfamiliar with .NET encryption (MD5,XOR), so please provide some sample codes if...
8
2988
by: dave | last post by:
Hi there I'm trying to force save as dialogue using this code in download.asp..but when it runs it prompts for download.asp to save or open. code snippet (from aspfaq.com) Response.ContentType = "application/x-unknown" ' arbitrary fn = "wallpaper_1_1.jpg" Response.write "<br>" & Server.MapPath("wallpaper") & "<br>" FPath = Server.MapPath("wallpaper") & fn
1
10463
by: John Beard | last post by:
I downloaded the attached code from MS. It flips on the "User Cannot Change Password" on a user in AD and works great from a console or windows app, but when put into an ASP.NET app I get a "The security ID structure is invalid." error when trying to assign the new security descriptor. I am running in Windows Authentication mode with IIS set to Integrated security on an XP box. Does anyone have a work around for this? Thanks in...
1
9796
by: techBoy | last post by:
I installed MySQL4.0. No for creating a databse the help says like go to "mysql>" prompt and then enter some commands. How do I get this prompt ??
2
4770
by: Ofer | last post by:
Hi, We use the ASP.net loginControls and the DB schema. How to programmatically activate the "PasswordRecovery" of a specific end-user when a user clicks my web application's button? I need to send a specific user an email with a new "reset" password. I thought of including an invisible PasswordRecovery Control and initialize the "User Name" field. PasswordRecovery1.UserName = "zako";
2
4409
by: btguser | last post by:
Visual Basic 6 Access 97 Windows 2000 I created a database programmatically with vb. My application is able to create and open the database with the password I set. However, when I manually doubleclick on my database to open it, I type in the same password and it says "Not a valid password". I have 4 different applications with the same code (except for queries) and 2 out of those give me that problem. Any idea as to what the problem...
0
2550
by: FrankieBakerJr | last post by:
Hello all I have an ASP.NET 2003 application (running Windows XP) that allows user to change and reset their Active Directory password. I'm using an admin account to query and reset the passwords once the user enters criteria to identify themselves. I want to check, in code, the Account Option "User cannot change password" in Active Directory to determine if they can or cannot change their password but I don't know how to do that. Any help...
1
2675
by: ramprakashjava | last post by:
hi , i hav this error while running this customerDetails.jsp <html:html> <head> <html:base/> </head> <body> <html:errors/> <html:form action="/submitCustomerForm"> <bean:message key="prompt.customer.firstname"/>
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10448
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9046
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7544
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2922
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.