I’ve been a fan of the popular Son of Obsidian theme for Visual Studio since it came out a couple of years ago. However, I’ve found myself using Sublime Text 2 more and more because it’s lightweight, fast and has some great features that almost make it full like a full IDE without the bulk. However, I missed my Son of Obsidian theme, so awhile back I decided to port the theme and create a Sublime/Textmate compatible version.
You can find it on GitHub here.
If you have any changes, please feel free to fork it and contribute.
I have received a couple of questions over the past few weeks regarding how to properly get SimpleMembership to work with an MVC3 application. While it is pretty straightforward, the purpose of this post is to serve as a step-by-step “How To” setup SimpleMembership with an MVC 3 application from start to finish.
The following 4 simple steps will get you up and running with SimpleMembership in your MVC3 application in a matter of minutes. We’ll go into each step in more detail below.
- Create new Mvc3 Internet Application or use an existing one.
- Create your SqlServer, SqlExpress or SqlCompact4 database (we’ll be using SqlCompact4 in this example)
- Update Web.config with connection string to point to your database from step 2
- Install & Configure SimpleMembership.Sample package
Creating your MVC 3 Application
- Select File > New Project and Select ASP.NET MVC 3 Web Application.
- Pick your desired folder location and click Ok.
- Next, make sure Internet Application is selected and Razor is the View engine.
- In this case, we chosen to create a unit test project automatically for testing purposes.
- Choose OK to create your project.
Creating your database (SqlCompact4)
- Before we do anything else, we are going to create a SqlCompact4 database rather than using SQLExpress which is the default for new projects.
- To do so, right-click the App_Data directory and select Add > New Item.
- In the next dialog, select SQL Server Compact 4.0 Local Database, use “Database.sdf” as the filename and click Add.
Updating Web.config connection string
Now that our database is created, we need to update our connection string in Web.config to point to our SqlCompact4 database we just created.
- Open Web.config and locate the connection string named “Application Services”.
- Next, change the “Application Services” connectionString and providerName to the following:
<add name=“ApplicationServices“ connectionString=“data source=|DataDirectory|\Database.sdf“ providerName=“System.Data.SqlServerCe.4.0“ />
Installing & Configuring SimpleMembership
Now, that we have our application ready, SqlCompact database created and ready to go, now we can install SimpleMembership. For the sake of simplicity, I’m going to install the SimpleMembership.Mvc3.Sample package which include the sample account controller pre-wired for use with SimpleMembership.
- In Visual Studio, navigate to Tools > Library Package Manager > Manage NuGet Packages.
- Select Online from the left-hand pane and type in SimpleMembership in the search box at the top right.
- Select the SimpleMembership.Mvc3.Sample package and click Install.
- Next, delete the existing Controllers/AccountController.cs file that Visual Studio created for you.
- Rename Controllers/SimpleMembershipAccountController.cs to AccountController.cs
- Open App_Start/SimpleMembershipMvc3.cs and update it to point to the “ApplicationServices” connection string or your appropriate connection string.
You’re application is now ready to use SimpleMembership and you have a fully-functional AccountController.cs pre-wired to use the SimpleMembership API.
Please post a comment if you have questions or run into issues.
The code is available here: SimpleMembership.Mvc3.Example.zip
Since everyone and their mother is talking about REST these days and the fact that Microsoft’s latest big bet is Windows Azure, I decided “Rest Azured” was a good name for my new blog. I chose “Rest Azured” because it was catchy, technically relevant, and the domain was available . The name by no means implies what content will be covered. It’s simply a name that I liked and one that I could see lasting at least for the foreseeable future. Plus, it sounded better than “Adam’s Blog.”
What will I blog about? Who knows, maybe Silverlight (I’ve been playing with that a lot lately), maybe iPhone development (I’m trying to get an app off the ground), maybe even REST or Azure since they’re part of my blog’s title for crying out loud!
Rest Azured (pun intended), the things I will blog about will be technical in nature and I guarantee that you may (or may not) find topics that are of value to you…but go ahead and snoop around!