Reputation: 399
I am using the Membership provider in my project. On creating new user with Membership provider, its accepting the invalid email address.
MembershipUser objUser = Membership.CreateUser (User.UserName, User.Password, User.Email, User.PasswordQuestion, User.PasswordAnswer, User.IsApproved, out objStatus);
Example: User.Email="sample", User.Email="t" its not validation the email given was a valid one.
Do i need to change any configuration to enable the validation.
Upvotes: 0
Views: 215
Reputation: 675
As far as i could see in the SqlMembershipProvider documentation (https://msdn.microsoft.com/de-de/library/system.web.security.sqlmembershipprovider(v=vs.110).aspx) it does not offer any methods for e-mail validation.
The simplest way for you would be to subclass the SqlMembershipProvider class and to override the CreateUser method with your desired validation and afterwards calling the base method if everything is ok.
Then you have to configure your new provider as default membership provider and you can continue consuming it the same way as you already do, calling Membership.CreateUser
.
Upvotes: 2