Castle ValidateEmail 属性在加号上失败

发布于 2024-07-30 19:06:03 字数 612 浏览 7 评论 0原文

我在我的模型上使用 Castle Validators。 我的 EmailAddress 属性定义如下:

[ValidateEmail]
public string EmailAddress { get; set; }

问题是 ValidateEmail 属性使用的正则表达式 (?) 不正确。 例如,如果我输入类似 [email protected] 的电子邮件地址,它验证正确,但如果我输入像 [email protected] 这样的地址,它说它无效。

我意识到我可以将 ValidateRegExp 属性与我自己的正则表达式一起使用,但如果可能的话,我更愿意使用系统中已内置的内容。

那么有什么方法可以“修复”ValidateEmail 属性吗?

I am using Castle Validators on my model. I have an EmailAddress property defined like so:

[ValidateEmail]
public string EmailAddress { get; set; }

The problem is that the regex (?) that the ValidateEmail attribute uses is incorrect. For instance, if I put in an email address like [email protected], it validates correctly, but if I put in an address like [email protected], it says it is not valid.

I realize that I can just use the ValidateRegExp attribute with my own regex, but if possible, I'd prefer to use what's already built in to the system.

So is there some way to "fix" the ValidateEmail attribute?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心舞飞扬 2024-08-06 19:06:03

请从构建服务器获取最新版本,这是几周前修复

Please get the latest build from the build server, this was fixed a couple of weeks ago.

妳是的陽光 2024-08-06 19:06:03

鉴于 Castle 项目是开源的,请获取源代码并自行修复。 然后将补丁提交回项目。

项目维护者会欣赏它(通常是;YMMV)并且项目会变得更强大。

Given that the Castle project is open-source, grab the source and fix it yourself. Then submit the patch back to the project.

The project maintainers will appreciate it (normally; YMMV) and the project gets stronger.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文