使用ASP.NET成员资格时,请确保所有电子邮件地址都是唯一的 [英] When using ASP.NET Membership, ensuring all e-mail addresses are unique

查看:81
本文介绍了使用ASP.NET成员资格时,请确保所有电子邮件地址都是唯一的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hiya,

我正在使用Visual Studio中提供的创建用户向导"来为我的系统创建用户帐户,无法解决如何确保用户名和电子邮件地址都唯一的问题.我已经在网上搜索过,并且在几本书中找到了我们无法找到的解决方案.

有人可以帮忙吗?

Hiya,

I am using the Create User Wizard provided within Visual Studio to create user accounts for my system and cannot work out how to ensure that both the username and email address are both unique. I have searched online and within a couple of books we have here and can''t find the solution.

Can anyone help?

Thanks in advance!

推荐答案

如果您使用的是运行aspnet_regsql时提供的默认值,则会创建一个名为aspnetdb的数据库.在此表中有一个名为aspnet_User的表,在该表中有一个名为UserName的列.

这是否给您有关如何检查唯一用户名的任何想法?
If you are using the defaults supplied when running aspnet_regsql then a database named aspnetdb is created. Within this there is a table called aspnet_User and within that a column named UserName.

Does this give you any ideas of how to check for unique user names?


检查这些博客
http://www.4guysfromrolla.com/articles/062508-1.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/ff648345.aspx [ ^ ]
--NDK
check these blogs
http://www.4guysfromrolla.com/articles/062508-1.aspx[^]
http://msdn.microsoft.com/en-us/library/ff648345.aspx[^]
--NDK


马克,

我已经解决了如何使用以下方法检查电子邮件地址是否正在使用:

Membership.GetUserNameByEmail(电子邮件字符串);

如果电子邮件地址确实存在,我该如何阻止向导继续进行操作?

谢谢
Hi Mark,

I have worked out how to check whether the email address is being used by using:

Membership.GetUserNameByEmail(string email);

How would I then prevent the Wizard going on any further if the email address does exist?

Thanks


这篇关于使用ASP.NET成员资格时,请确保所有电子邮件地址都是唯一的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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