Tutorial :Multiple Security Questions in ASP.NET Membership


We are using the ASP.NET Membership Provider for managing the users in our application.

All was fine until when we had a new requirement. Users should be able to select multiple security questions and give answers to the same.

While recovering the password, the user will be presented with one of the security questions and if the user answers correctly the password will be sent.

By default ASP.NET Membership provides only one security question and one security answer. Is there is any way to make it use multiple ones?


Creating your own custom ASP.NET membership provider would be the key. Additionally, you'd have to create a custom template for the .NET login controls that use the password Q's, so that you can display multiple question/answer sections.

You may have to set the membership provider to not use the password question/answer, but programmably manage it yourself. By default, it uses that single Q/A to manage security; but since you need multiple, it may be easier to use custom logic to manage this.

EDIT: the only other thing I can think of is have two provider definitions, each with their own password question/answer, so that you are effectively storing two records in the database per user. The thing is that the UI controls won't work with that approach, so you would need to custom build the UI.



You could customize the default ASP.NET Membership provider to your specific requirements by subclassing it.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »