ASP.NET SQLMembershipProvider - email as username

醉酒当歌 提交于 2020-01-04 09:16:09

问题


I'm about to start building a new asp.net project, and I'm just starting out with the whole thing of SQLMembershipProvider. What I really want to do is to remove the need for a username and just have the key to the user as the email address.

It seems to me that the easiest thing might be to change the stored procedures to just remove the email address from the tables, and when someone does a search by email, just to use the key (I also need to deal with someone changing their email address...

Before I start, does anyone know a pre-rolled example out there. It just seems too common to have to build it.


回答1:


You don't need to change anything in the provider. Just set the email as user name upon registration and don't provide any means in the UI to change the email address. It'll do the work easily.




回答2:


You could modify the procedures... or just omit the email or username fields in your forms/ui and use one or the other behind the scenes to populate the other field. This might be duplicate data, but you might find a need to have an email that isn't also the username down the road.



来源:https://stackoverflow.com/questions/591919/asp-net-sqlmembershipprovider-email-as-username

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