MVC 3 RC VS 2010 Template w/ Razor, Html 5 Boilerplate and OpenId Authentication

Updated 3/21/2011:

Now with twitter and oauth support. See the latest update

You can pull the source files from the GitHub page, or download the zip containing the template.

I’ve created an (arguably) bare-minimum Visual Studio 2010 Template for getting started with MVC 3 Preview 1 using the Razor view engine and some other web goodies. I got tired of the vanilla “Welcome to MVC” homepage and I’m not a fan of the MembershipProvider abstraction and all the Account junk included by default.  This template is meant to provide a bare-bones setup of Html 5 and provide OpenId authentication for users (but not full-on user management)- it’s a simple cocktail of Html5 Boilerplate and DotNetOpenAuth.  The rest is left up to you to build up!

Paul Irish’s Html5 Boilerplate

Paul Irish created a nice starting point for Html5 websites with his Html5 Boilerplate.  There’s a lot of goodies in it which go beyond just changing the DOCTYPE.  Check out the  NetTuts+ official guide to Html5 Boilerplate explained by Paul himself.  I’ve ported over the .9 version with comments so you can see what’s what.  The only changes made where to replace the url’s in script and link tags with @Url.Content methods.  The original index page is at the root (you’ll want to delete, but it’s a handy reference) and the _Layout.cshtml now has a Header and Script section to use in child pages.  This functionality is used in the LogOn view to set up OpenId authentication.

OpenId with DotNetOpenAuth

I was never a fan of the stock MembershipProvider infrastructure and setup of the sql tables required for user management.  Usually, user management requires very specific needs site to site, and the default functionality gets butchered anyway.  So all that stuff gets pulled and replaced with the ease and simplicity of OpenId.  The template uses the OpenId Selector on the login page and DotNetOpenAuth with Forms Authentication on the backend.  There’s no Register page, as the specifics of the required user schema varies too much.  But you should be able to combine the OpenId logic on the Login page with a new Register page to suit your needs.  There’s also no persistence store integrated into the template as that is left entirely up to you.

Future Plans

I really have no set goals for this template, so it will evolve in a free form manner.  The code is on GitHub so feel free to branch and edit as necessary.  I’m going to add some unit tests around the OpenId logic, and possibly evolve the Account creation in some way.  So that’s about it!

Downloads

You can pull the source files from the GitHub page, or download the zip containing the template.

  • Pingback: DotNetShoutout

  • Pingback: The Morning Brew - Chris Alcock » The Morning Brew #673

  • http://blog.runxc.com Bret Ferrier @runxc1

    Good Decision on going with OpenAuth. I have always disliked ASP.NET Membership and all of its Guids and stored procs.

  • Pingback: Updated: Visual Studio Html5OpenId Template. Now with MVC 3 RC and Html5 Boilerplate 0.9.5 | Adventures in HttpContext

  • http://www.codegusto.com Robert

    Great template! Thanks for putting this together.

    I added a couple of items to the Issues log on github.

    https://github.com/mhamrah/Html5OpenIdTemplate/issues

    They should be simple to update.

    -Robert

  • byunru

    How the web application get the logon user alias or user name from Google account after signed in?

  • Marcia

    Thanks for the template, can you please help figure out how to install it on VS2010

  • http://www.dotnetkicks.com/submit?url=http%3a%2f%2fwww.gajotres.com%2fpost%2f2011%2f09%2f14%2fGet-every-input-field-on-page-and-create-xml-with-aspnet.aspx&title=Get+every+input+field+on+page+and+ asp.net, c#,javascript

    Wonderful goods from you, man. I have understand your stuff previous to and you are simply extremely great. I really like what you’ve got here, really like what you are stating and the way in which during which you assert it. You’re making it entertaining and you still take care of to stay it wise. I cant wait to read much more from you. This is really a terrific site.

  • http://url.org/bookmarks/kratom Anonymous

    Excellent site. A lot of helpful info here. I’m sending it to some friends ans also sharing in delicious. And of course, thanks in your sweat!