May 11, 2011

Tiny Membership Providers

Tiny Membership Providers

I've needed to move an ASP.NET MVC project away from using SQL Server for logon (SQLMembershipProvider).

Searching for 'membership' on Nuget's "Add Package Library Reference" dialog, I've stumbled upon Artem.XmlProviders40 package that implement the trio of providers (memebership, roles, profiles) using xml files as storage. Nicer, the Nuget even updated the web.config to add the providers in the application.

Dumbly I deleted the SQL providers lines and tried to run, after inspecting the users file to find the password for some user there, and pressed F5 to run the app. Clicked on "Log On", and CRASH!!!

Needed to peruse the Web.config of the SampleWebSite project in the sources (http://tinyproviders.codeplex.com/SourceControl/changeset/view/6d50b098f088#SampleWebSite%2fWeb.config).

To find out that I needed to add the defaultProvider attribute to the membership element (and the other two), naming the specific provider to use as being the Xml... part, as named in the providers/add child element.

Also I needed to set the applicationName attribute to "/", as this is an MVC app able to deal with all paths...

Why do I need to get hid of SQL Server, on these days of SQL Compact marveldom? To be able to run in Linux, of course.

Also as the system has just one non-anonymous user: the famous "admin", it is just overkill to have a database even when deployed on a Windows server...