字母数字密码 [英] Alphanumeric Password

查看:77
本文介绍了字母数字密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想限制我的用户仅输入字母数字密码才能打开我的应用程序.请提供相同的C#代码或算法.

I want to restrict my user to strictly input alphanumeric password only to open my application. Please provide c# code or algorithm for the same.

推荐答案

注册文本框KeyPressEvent
Register Textbox KeyPressEvent
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
// Allows only Alpha-Numeric’s
if (!(Char.IsLetter(e.KeyChar) || Char.IsDigit(e.KeyChar) || Char.IsControl (e.KeyChar)))
e.Handled = true;
}


引用密码强度控制 [ ^ ]

它具有用于测量密码强度的出色代码.
希望对您有所帮助.

一切顺利.
Refer Password Strength Control[^]

It has an excellent code to measure password strength.
I hope this helps.

All the best.


只是一个提示:即使在用户的首选项中,您想要的内容也被认为是不安全的做法.查看有关密码强度的任何文章. Pravin的回答可能非常充分.

虽然其他作品尝试提供鼓励用户创建更强密码的方法,或者通常通过拒绝简单密码来将密码限制为更强密码,但您却恰恰相反!

当然,这取决于您,但是您根本无法帮助客户.允许它们完全使用任何密码将是很多很多的改进方法.

谢谢您的理解.

—SA
Just a note: what you want is considered as unsafe practice even in user''s preferences. Look at any article on password strength. Pravin''s answer is probably very adequate.

While other works tries to offer ways of encouraging users to create stronger passwords or, very typically, limits passwords to stronger ones by denying simple ones, you do exactly the opposite!

This is up to you, of course, but you''re not helping your customers at all. It would be much, much, way to much better to allow them using any passwords at all.

Thank you for your understanding.

—SA


这篇关于字母数字密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆