I’ve walked through how to create a new Web site using an
open source application within the web gallery. Let’s now look at how we
can alternatively use WebMatrix to do some development of a custom site.
The two right-most icons on the WebMatrix home-screen
provide an easy way to create a new site that is either based on a simple template
of pages, or an empty site with no content:
Let’s click the “Site From Template” icon and
create a new site based on a template. We’ll select the “Empty Site”
template and name the site we want to create with it “FirstSite”:
When we click the “ok” button WebMatrix will
load a site for us, and display a site overview page that contains links to
common tasks:
Let’s click either the “Files” icon in the
left-hand navigation bar or the “Browse your Files” link in the middle
overview-screen. Selecting either of these will show us the file
explorer. The “Empty Site” template actually does have one file in it by
default – a file named Index.cshtml. We can double-click it to open it
within the WebMatrix text editor:
Files with a .cshtml or .vbhtml extension are ones that use
the new “Razor” template syntax that I blogged about last week. You can use Razor files
either as the view files for an ASP.NET MVC based application, or alternatively
you can also use them as standalone pages within an ASP.NET Web site. We
are referring to these pages as simply “ASP.NET Web Pages” – and you can add
them to both new projects as well as optionally drop them into existing ASP.NET
Web Forms and ASP.NET MVC based applications.