如何请用"电子邮件"代替"用户名"在ASP.NET MVC 4简单会员 [英] How to sign in with "E-Mail" instead of "UserName" in ASP.NET MVC 4 Simple Membership

查看:177
本文介绍了如何请用"电子邮件"代替"用户名"在ASP.NET MVC 4简单会员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发的ASP.NET MVC 4.应用程序的入门级应用程序将有一个会员制。我想用集成SimpleMembershipProvider因为创建一个新的将是复杂的我。因此,用户必须登录到应用程序与他们的电子邮件不会忽略,而不是用户名作为SimpleMembershipProvider。但我不能让这种变化。为做到这一点是创造我自己的成员提供的唯一途径?

I am developing an entry level application with ASP.NET MVC 4. The application will have a membership system. I want to use integrated SimpleMembershipProvider because creating a new one will be complex for me. So the users must log in to application with their e-mail adresses instead of user name as in SimpleMembershipProvider. But I couldn't make this change. Is the only way to do this is creating my own membership provider?

推荐答案

使用电子邮件查找用户的ID。该用户传递给会员和验证与用户。

Use the email to find the id of the user. pass that user to membership and authenticate the user with that.

您可能还需要prevent重复的电子邮件在注册用户,以确保1电子邮件返回1帐户的时间。下面的文章将在此塞纳里奥帮助:

you may also want to prevent duplicate emails at the time of registering user to make sure 1 email returns 1 account. the following post will help in this senario:

<一个href=\"http://stackoverflow.com/questions/10232706/how-does-one-$p$pvent-duplicate-email-addresses-while-users-modify-their-email-ad\">How做一件prevent重复的电子邮件地址,而用户使用默认的MVC成员资格提供修改登记后他们的电子邮件地址?

你也可以在表中创建一个独特的密钥对电子邮件,以确保没有重复的邮件将被注册。

Also you may create a unique key in the table for the emails to ensure no duplicate emails will be registered.

这篇关于如何请用&QUOT;电子邮件&QUOT;代替&QUOT;用户名&QUOT;在ASP.NET MVC 4简单会员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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