参数“用户名”不得包含逗号。参数名:用户名 [英] The parameter 'username' must not contain commas. Parameter name: username

查看:270
本文介绍了参数“用户名”不得包含逗号。参数名:用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用asp.net memebrlogin_control并得到异常参数用户名不得包含逗号参数名:用户名。我使用EMAILID在该用户名

I am using asp.net memebrlogin_control and getting exception "The parameter 'username' must not contain commas. Parameter name: username". I am using emailID as username in this

如何删除这个错误,我也想知道,什么是应该被禁止,以验证邮件地址的字符列表中。

How can I remove this error, and I would also like to know that what is the list of characters that should be disallowed to validate email address.

推荐答案

RFC 2822 了解完整的电子邮件地址的语法。如果通过BNF工作,你会看到@,@@ foo.bar 是完全正常,如有异常。你问的规则,不过,可以在第3.2.4节中:

Read RFC 2822 for the complete email address syntax. If you work through the BNF, you'll see that "@,@"@foo.bar is perfectly fine, if unusual. The rule you're asking for, though, can be found at section 3.2.4:

atext           =       ALPHA / DIGIT / ; Any character except controls,
                        "!" / "#" /     ;  SP, and specials.
                        "$" / "%" /     ;  Used for atoms
                        "&" / "'" /
                        "*" / "+" /
                        "-" / "/" /
                        "=" / "?" /
                        "^" / "_" /
                        "`" / "{" /
                        "|" / "}" /
                        "~"

atom            =       [CFWS] 1*atext [CFWS]

dot-atom        =       [CFWS] dot-atom-text [CFWS]

dot-atom-text   =       1*atext *("." 1*atext)

和3.4.1节:

addr-spec       =       local-part "@" domain

local-part      =       dot-atom / quoted-string / obs-local-part

domain          =       dot-atom / domain-literal / obs-domain

如果你忽略了一切,但点原子本地部分规则,你将匹配共或花园地址。这有可能是你的asp.net控件不接受所有有效的RFC2822地址,所以你应该检查文档。

If you ignore everything but dot-atom in the local-part and domain rules, you'll match the common-or-garden addresses. It's possible that your asp.net control doesn't accept all valid RFC2822 addresses, so you should really check that documentation.

您可能会做同样的事情到%<十六进制code基诱骗到一个有效的(或没有)的电子邮件地址转换为用户名的说法,你的控件可以接受的。

You might do something similar to the "%<hexcode>" trick to convert a valid (or not) email address into a username argument that your control can accept.

精通正防爆pressions 的由O'Reilly用于对邮件地址的一个巨大的单页正则表达式(主要是正确的),但它的消失在第3版。)

(Mastering Regular Expressions from O'Reilly used to have a humongous one-page regex (mostly correct) for mail addresses, but it's gone in 3rd ed.)

这篇关于参数“用户名”不得包含逗号。参数名:用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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