In my WinForms project, I have 2 Inputboxes pop up asking the user for a username and a password and I would like to mask the text entry on the password inputbox.
Currently the code simply looks like:
_Passwd = InputBox("Please Enter the Corresponding Password" & vbCrLf & _
"Leave blank to abort program", "New Credentials Needed", "")
I was wondering if there was either a way to mask the text on the inputbox or if there was another pre-defined object in .Net I could use without creating my own userform with a masked textbox? (I know it's easy, just seems like more hassle than is needed if Microsoft already has it pre-created)
I haven't tried it but from description may help you :
http://visualstudiogallery.msdn.microsoft.com/1e5295a5-d7bd-4789-bced-361c608a3a7e
There is nothing built-in for this -- you have to create your own.
Related
I am using the PasswordRecovery Control in my ASP.NET WebForms Application (C#), now the thing is, When we are using PasswordRecovery Control, we are forced to use Wizard Control, which means, if the user enters username correctly, it will then hide textbox and display success message (or whatever you put in SuccessTemplate).
Now, the issue is by this way, when Unauthorized user, tries to access the application, they can try this control to get the actual username from the application (security risk). So, if they try the wrong username, they will get the "UserNameFailureText" and if they will enter the proper username, they will see the next template (SuccessTemplate) which will show a success message (By this way, they can get that the entered username is available in the system or not), so I want to remove the wizard structure, in all scenario, the textbox with a username will stay on the screen, and no matter what user enters, he will see a generic message "if you have entered the correct username, you will receive an email" Like that.
If anyone has any idea whether it's possible in PasswordRecovery control, or should I have to build a custom Page?
PS: I have tried removing SuccessTemplate from the page, it will automatically take the default success template.
I don't see why you can't just create a page from scratch? All that text box will do is check if the user exists, send them the email, and display your message. There not a whole lot of reasons thus to use the built-in template.
So, a simple button re-set password can run some code behind, send the re-set email, and set a label or text box, or even some "div" as visible = true to display your message. You don't mention or note that authentication provider you are using - but given the built in templates - then that suggests FBA, and thus the tables that drive the site and hold user + passwords should be fully available to your code behind.
On the other hand, you might have to add some kind of password re-set table, and say include a GUID generated ID, and the datetime. That way, the link you send in the email is specific to the one user - and has a limited time before that link expires.
Or I suppose the link in the email just directs them to the new password page - but I tend to toss in a GUID that is checked against that new re-set table. With the guid, then when they click on their email link, you can display their name, and only prompt for the new password. The email link simply includes that GUID as a parameter, and you pull that one row from the re-set table to get who is about to re-set their password.
I'm working on a Windows form application where I want to automate some tasks. I'm have a problem when it comes to password fields.
My problem is when I press the submit button it says incorrect username/password. When I pass my text into the text fields like:
Username: hey
Password: hey
(So in the password field it's still plain text but it should have changed to ●●●)
I guess it's becuase I set the value, and that's why it only works with the username.
I have also tried:
element.InnerText = "hey";
Does anyone know how I can insert a valid password "text" like ●●● insert of plain text.
I don't know if it has any significance but there is also some javascript on the textfield (on the site I'm trying to login at).
Another thing is when i inspect the source I can see that the passwords field type="text"?
I have tried other automation software and I can see that they can't insert into the password field either. So perhaps there is some kind of blockage here?
I hope I make myself clear, else I would gladly explain in more details.
And I must say I have almost searched the entire web without any luck! :p
Thanks
Solved
The problem was that there was a textbox on top of the password field. I suddenly saw that after I looked in the source code again!
On the textbox on witch you type the password change the textbox.PasswordChar proporty to ●
textbox1.PasswordChar = '●';
The problem was that there was a textbox on top of the password field. I suddenly saw that after I looked in the source code again!
The thing there confused me was because I couldn't see any there were any text inserted. lol
i am generate random password and show it in a textbox.
when i am set textbox property textmode to password then it doesn't show in textbox but when i set it singleline then password shows in textbox.
I am using following code --
textbox1.attributes.add("value",passwordvalue);
for show i am using --
textbox1.text = textbox1.attributes["value"].tostring();
Same happing with when i edit record. password doesn't show in textbox.
When you set a textbox in password mode, it renders as an <input type="password" >, which hides what's written in it, but this also forbids setting the value of the field. A password field is strictly for users to type in, you can't pre-fill it with anything.
If you want a textbox that hides the characters, but still allows setting the initial value, you have to build it yourself (or find something that someone else built) using HTML and client script.
Does this help?
HTML
<body>
<input type="text" id="passbox" />
<input type="submit" onclick="generate_password()" value="Generate Password" />
<input type="submit" onclick="toggle_passbox()" value="Toggle Box" />
</body>
JAVASCRIPT
function passbox() {
return document.getElementById('passbox');
}
function generate_password() {
passbox().value=Math.random().toString(16).slice(2);
}
function toggle_passbox() {
passbox().type= passbox().type == "password" ? "text" : "password";
}
You can test this at http://jsbin.com/uxano3
textbox1.text = "yourrandompassword"
i dont get what you are trying to do with the attributes.
Are you using a asp control element for the textbox?
if you are generating a random password, i guess you want to show it to your user, not hide is with the asterix'es?
That approach doesn't make sense since even if it showed it would be just *****, and then that leaves the user in the same situation. The password field just isn't meant to be showed.
If you must keep with the generate random password, you could:
Show some simple text above the password field, something like: "Please enter your password in the field below. Alternatively leave it blank, and use this password we have generated for you: SomeNicePassword"
About the edit scenario, you shouldn't have passwords in clear, its just not safe and could upset some customers. Besides, an edit password feature usually requires the user to enter their current password and the new one in separate fields, to make sure it wasn't that it wasn't that the user left the session open and someone else is trying to take over the account.
If you want to use Vb.net you will have to use the following code for creating textbox as password
textbox1.passwordchar="*"
If you want to use C Sharp you will have to use the following code for creating textbox as password
textbox1.passwordchar='*';
If you want to use C++ you will have to use the following code for creating textbox as password
textbox->passwordchar='*';
C# doesn't want to put Unicode characters on buttons. If I put \u2129 in the Text attribute of the button, the button displays the \u2129, not the Unicode character, (example - I chose 2129 because I could see it in the font currently active on the machine).
I saw this question before, link text, but the question isn't really answered, just got around. I am working on applications which are going all over the world, and don't want to install all the fonts, more then "don't want", there are that many that I doubt the machine I am working on has sufficient disk space. Our overseas sales agents supply the Unicode character "numbers". Is there another way forward with this?
As an aside, (curiosity), why does it not work?
The issue is:
C# will let you put Unicode in, like button1.Text = "Hello \u2129";, no problem
but the Visual Studio Forms designer will not recognize '\u2129' as anything special. By design.
So just paste in the '℩' in the Properties Window or use code.
Change the "Font" of the button to the "Font" (From google:Arial Unicode MS) which supports "u2129". It may help you
have you tried entering the characters manually? also, have you tried using a literal string with #"blahblahblah" ?
I was trying to include copyright symbol (\u00a9) in the form title. Using escape characters or changing fonts didn't work for me. I simply copy-pasted the symbol from text editor.
I need a quick text input dialog box (MessageBox with a single text box in it). Is there any control available or should I use a form?
I just want user to enter some ID. And in other occasion I want 2 texboxes for username and password.
Microsoft.VisualBasic.dll has an InputBox method which you can use from C# to get a single string.
For example (Add a reference to Microsoft.VisualBasic.dll first)
using Microsoft.VisualBasic;
string response = Interaction.InputBox("Enter a string:", "MyApp", "DefaultString", 0, 0);
Othewise, you'll have to make your own form.
simple one is inputbox