ASP.NET SqlMembershipProvider:唯一但不是必需的电子邮件?
有没有办法配置 ASP.NET SqlMembershipProvider,使电子邮件是可选的,但提供时必须是唯一的?
我只找到了 requiredUniqueEmail
属性 (web.config),它使电子邮件成为强制性的。我是否必须在帐户注册过程中忽略这一点并自行检查现有电子邮件地址?
或者有更好的方法来处理这种情况吗?
Is there a way to configure ASP.NET SqlMembershipProvider such that Email is optional but when provided must be unique?
I only found the requiredUniqueEmail
attribute (web.config) which makes Email mandatory. Do I have to leave this out and implement checking for existing email addresses myself in the account registration process?
Or is there a nicer way to handle this scenario?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种简单但可能有风险的方法是直接修改存储过程来执行此操作。
修改
aspnet_Membership_CreateUser
,将: 替换为:我
说这是有风险的,因为没有人会期望您修改此内容,并且您最好很好地记录更改。
An easy, but probably risky way, is to modify the stored procedure directly to do this.
Modify
aspnet_Membership_CreateUser
by replacing:with
I say it's risky because nobody would expect you to modify this and you'd better document the change well.