Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>SimpleMembershipProvider is not email aware. It literally has no concept of email as you'll note if you look at the default auto-generated schema. This is why many of the legacy MembershipProvider APIs are unsupported by the SimpleMembershipProvider implementation.</p> <p>You can of course add an email column to the UserProfile table (as I assume you've done), but the provider has no mechanism for implementing RequiresUniqueEmail, and is in fact hardwired to always return false. Adding a database constraint will work to some extent but only by causing an Exception when the the profile is updated. It's not at all elegant, but should work.</p> <p>You could tell SimpleMembershipProvider to use email as username when initializing the provider, but this means losing userName field and requiring users to login with email/password which may not be preferable.</p> <pre><code>WebSecurity.InitializeDatabaseConnection(connectionString, "UserProfile", "UserId", "Email", true); </code></pre> <p>An alternative is to extend the SimpleMembershipProvider, make it email aware, and implement RequiresUniqueEmail. </p> <p>Take a look at <a href="https://github.com/TheCodeKing/BetterMembership.Net" rel="nofollow">BetterMembership.Net</a> on GutHub, it does exactly that and can be used as a replacement for SimpleMembershipProvider. The email column is specified on the provider, and it supports RequiresUniqueEmail out-of-the-box.</p> <pre><code>&lt;add name="BetterProvider" type="BetterMembership.Web.BetterMembershipProvider, BetterMembership, Version=1.0.1.0, Culture=neutral, PublicKeyToken=737bc70442f2c4af" connectionStringName="DefaultConnection" userIdColumn="UserId" userNameColumn="UserName" userTableName="UserProfile" userEmailColumn="Email" requiresUniqueEmail="true" autoInitialize="true" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload