473,946 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mask password in c# console application?

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
Nov 15 '05 #1
2 11350
Your best bet may be using this:
http://www.gotdotnet.com/Community/U...s/Details.aspx
?SampleGuid=b76 d1f08-2d79-47bd-825b-0489938aae0f

It's a Microsoft sample API showing how to manipulate
other aspects of the console and may help you mask input.
-----Original Message-----
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 thebackgroud color through native API, but it doesn't really hide the password,actually, users can manually change the foregroud color in a windows consolewindow, or they can copy the password from the right place of the screendirectly even they do not 'see' it. Is there a better way to do it?
thanks
Yang Liu
.

Nov 15 '05 #2
Thanks Richard, got it.

"Richard A. Lowe" <ch*****@yumspa myumYahoo.com> wrote in message
news:13******** *************** *****@phx.gbl.. .
Your best bet may be using this:
http://www.gotdotnet.com/Community/U...s/Details.aspx
?SampleGuid=b76 d1f08-2d79-47bd-825b-0489938aae0f

It's a Microsoft sample API showing how to manipulate
other aspects of the console and may help you mask input.
-----Original Message-----
Hi
Is it possible to mask console input in a c# console

application?
What I mean is: if I entered string "test" in the

Nov 15 '05 #3

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

Similar topics

2
7076
by: Francis Debrabandere | last post by:
Hi all, I'm a beginner in ms access, and I'm working on my first real application. But to finish it up I'm facing a problem. I'm not able to solve and maybe someone can help me. I have made a database that can be divided in two major parts: 1. entering data 2. reading the entered data. Everybody who uses the database has access to the second part. The
1
6017
by: John | last post by:
I am creating an application which is password controlled on startup. I created a textbox for the user to enter the password. However, I would like to also have a menu option so the user can choose to see '*' in the password box, or the plain text that they are typing in. I want to do this because it is for pocketpc2002 and the characters might not always appear as you think you are writing them in, hence the user option. The problem...
1
1917
by: Joe Spin | last post by:
Hi, I'm using the TextBox.PasswordChar property with a '*' to mask passwords written in the textbox. In some workstations it works fine , but there are some workstations (win2K and XP) that when the user enters the password it is not masked and you can see the actual chars and not the asterisks. I've never seen anything like it.
2
6488
by: SharpCoderMP | last post by:
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
0
1738
by: gibsonsgman | last post by:
Hello, I have a form with a text field on it. I have applied the 'Password' input mask because it is a password field. However, when I enter the correct password, it says the password is incorrect. If i take the input mask off it works. Is there any reason why this would happen? Here is my code if that helps. If strInput = strpassword And frmDisableandEnable.Value = 1 Then SetProperties "AllowBypassKey", dbBoolean, True Beep...
3
11386
by: julianmoors | last post by:
Hey, Currently I'm writing a VB.NET/1.1 app and I need to mask the input for the password field. Does anyone know how to do this in VB? I've seen a C# example, but wouldn't know how to convert it myself. Here's the URL: http://www.codeproject.com/dotnet/ConsolePasswordInput.asp
11
3644
by: gopal | last post by:
Hi, I am trying to call the OSQL utility from my C# console application and i am having problems i have the following code In Main method ProcessStartInfo psi = new ProcessStartInfo("osql",""); psi.RedirectStandardInput = false;
8
3716
by: vermarajeev | last post by:
How can I create a C++ Console application, compiled with GCC, portable to Linux and Windows, with a password prompt without echo (does not show the password as you type it)? I would like something like those: - with stars echo: User: bob Password: ****** - or without any echo at all
5
3533
by: jehugaleahsa | last post by:
Hello: We have a request for an console application to change the administrative password on our user's machines during an upcoming update. The console application will be called from a batch file that the users will be able to see. Therefore, we can't put the user name/ password in the batch file or plain text in the executable. Finally, the request specifically asked that the executable be configurable so they can put other user...
0
10151
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
11556
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
11150
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...
1
11333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10685
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
7412
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3538
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.