Castle ValidateEmail Attribute fails on plus sign

℡╲_俬逩灬. 提交于 2019-12-24 11:07:57

问题


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 foo@foo.com, it validates correctly, but if I put in an address like foo+1@foo.com, 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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/1281092/castle-validateemail-attribute-fails-on-plus-sign

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!