简体   繁体   English

需要特殊字符的密码中是否有我不应该支持的特殊字符? (WebMatrix C#)

[英]Are there any special characters that I should not support in a password that requires special characters? (WebMatrix C#)

I have a password that requires special characters and was wondering if there were any special characters that I shouldn't support, such as "=" or "`" or ">", etc. 我有一个要求使用特殊字符的密码,并且想知道是否有我不应该支持的特殊字符,例如“ =“或”`“或”>“等。

Here is what I have so far: 这是我到目前为止的内容:

        if(c!='!' && c!='@' && c!='#' && c!='$' && c!='%' && c!='^' && c!='&' && c!='*' && c!='(' && c!=')' && c!='-' && c!='_' && c!='+' && c!='=' && c!='~')
        {
            Scount++;
            if(Scount >= password.Length)
            {
                errorMessage = "Your password must contain at least one special character.";
            }
        }

Ok, I guess I know I don't want to support angle brackets, but is there like a standard set of special characters that most sites support, or characters that I should definitely stay away from (besides angle brackets, those would probably trip up the WebMatrix validator in a lot of cases). 好的,我想我知道我不想支持尖括号,但是大多数站点都支持像标准字符集那样的特殊字符,或者我绝对应该远离的字符集(除了尖括号,那些字符可能会跳开) WebMatrix验证器在很多情况下)。

Please do not comment on the fact that I am not using a regular expression to check for patterns. 请不要对我没有使用正则表达式检查模式这一事实发表评论。 I know this and I do not care. 我知道这一点,我不在乎。 This was the first thing that worked for me, so that's what I'm going with. 这是对我有用的第一件事,所以这就是我要处理的。

Thanks for any help! 谢谢你的帮助!

Ever since I saw this excellent cartoon on XKCD on password strength, any site that forces me to use upper or lower case chars, numeric or alphabetic... well it makes me mad. 自从我在密码强度方面在XKCD上看到这本出色的卡通漫画以来,任何强迫我使用大写或小写字母,数字或字母的网站……这都使我发疯。 The only checking your site should do, should be checking for the length of the password. 您的网站唯一要做的检查应该是检查密码的长度。

If people want to enter 0bscur€ passwords fine, but don't force them to. 如果人们想输入0bscur€密码很好,但是不要强迫他们输入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM