If you’re a long time user of ASP.NET, you’re probably aware that the out of the box providers have some limitations. For instance, you couldn’t really use them with an SQL Compact database because they depended on stored procedure support for performing their actions. Besides that, clean up and maintenance in general depended on agents which run scheduled clean up tasks.
When Microsoft started working with Web Pages and the WebMatrix, they decided to have another go at this problem. Their first solution was known as universal providers and it solved the problem I’ve mentioned in the previous paragraph (ie, with the universal providers, you can store your data in a SQL Compact or SQL Azure db) . The easiest way to add the universal providers to your project is to run the following instruction from the Nuget console:
Notice that I’ve used plural (provider*s*) because the package ends up installing session, membership, roles and profiles providers. You should also keep in mind that the previous instruction will also update the web.config file so that the app uses all these new providers ( if you’re just interested in one or two, don’t forget to clean up your web.config file).
But the team wasn’t finished yet. They’ve decided to introduce another provider, known as the SimpleMembership, which is way more flexible in its requisites regarding data storage (even though it’s called SimpleMembership provider, the truth is that the package introduces two providers: one for roles and another for membership – this is the most important one). Instead of forcing the use of a specific database table, this provider requires only that you specify the name of the table which is holding your users accounts and the names of the ID and username fields used in that table.
Now, there’s already some resources out there which show you how to get started with this provider (for instance, this one does a good job of explaining what you can expect from it) and that’s why I won’t be wasting your time explaining how it works.
If you’re using Web Pages, you’ll end up getting this provider for free. However, if you’re using Web Forms and you like what you see in that post, then you’re probably wondering about what’s needed to add it to your app. Once again, Nuget is your friend here
All you need to do to use this provider from your app is to run the following Nuget instruction:
Now that you’ve added the required assemblies, I’ll leave it to you to explore the new features introduced by this new provider.
And that’s it for now. Stay tuned for more.