I went to create my first new website with Visual Studio 2010 the other day and was quite surprised with what I found.
In all versions prior to 2010 a new website would just get you a Default.aspx and the corresponding language codebehind file. This changes quite a bit with 2010. You actually will now be presented with a full website ready to go. Complete with a Master page, account login and more.
Digging in Further yields some nice little nuggets. First off the Site.Master isn’t just a blank master page with a ContentPlaceHolder. It actually contains a relatively decent CSS layout with LoginView and Menu controls.
Along with the Site.Master the site comes with Default.aspx, About.aspx and an entire directory dedicated to authentication. The Account directory is set up to handle all the most common authentication scenarios: Login, Register and Password Recovery. Furthermore these pages include actual code in the codebehind.
One thing however that it is missing is the database to authenticate with. If you are planning to use your own membership provider or an external database you just need to set it up in the web.config. If you’d like to just use an sqlexpress database you can use the ASP.NET Website Administration Tool to do this for you. This tool was added in .NET 2.0 and the current version doesn’t seem to have changed much. To generate the ASPNETDB.MDF SQLExpress database. Just click on the Tool and World icon in the Solution Explorer.
Another way to access this tool is via the ASP.NET Configuration command under the Website menu.
The best way to have it set up the database is to click on the “Use the security Setup Wizard..” link. This will take you through setting up the database, roles, users and locked down directories.
Beyond the account code the site comes with jQuery 1.3.2, it’s minified version and the Visual Studio Intellisense file. Unfortunately the jQuery files are not referenced by default in the master page or any of the other pages. I would have loved to have either an example usage or at least a reference to the file. To add jQuery it’s just a simple addition to the master file. After that just force VS to update its javascript intellisense using Ctrl+Shift+j
Rarely do I start out a website this way these days, most my sites I start are powered by one CMS or another. Besides those times I’ve been trying to use ASP.NET MVC more these days. I still use the default webforms site when I need to get something up and running quick with some basic data controls. I recently did a website for planning a family reunion. I could have saved myself a half an hour or so getting just the base of the site set up.