Thursday, December 15, 2011

Learning MVC: SQL CE Membership Provider for ASP.NET

I tried uploading my MVC application on the web server for the first time. That proved to be slightly more complicated compared to using a server in the local network. I chose www.discountasp.net as a provider due to several positive reviews I've found. Registration, of course, was easy, and accessing the "control panel" too. The machine I develop on, however, is behind the proxy and the corporate firewall, so for deployment I had to choose publish to local PC and then copy the files over to my home pc and then to the provider's ftp. Doing the application part was really easy - just copied the files to the ftp, deleted the default "index.htm" page, stopped and started the web site from the control panel, and I could see the application main page straight away. The troubles, as I expected, started with database. I tried modifying connection strings to point correctly to the corresponding folders on the host, but sometimes I got back the 500 error, and sometimes something slightly more meaningful like that one:

I was slowly going through the host's manuals and the knowledge base, but what solved all my issues was the SQL Compact ASP.NET Membership, Role and Profile provider. Essentially, that's just four files that need to be added to the project's App_Code folder. Next, the web.config file has to be modified according to instructions on Codeplex or in the author's blog.

And then it just works - no need for SQL Express, no additional configuration - just copied the files over to the host. Extremely positive experience.

by . Also posted on my website

No comments: