Let's build a simple page that lists out some content we are
storing in a database.
If you are a professional developer who has spent years with
.NET you will likely look at the below steps and think – this scenario is so
basic - you need to understand so much more than just this to build a
"real" application. What about encapsulated business logic, data
access layers, ORMs, etc? Well, if you are building a critical business
application that you want to be maintainable for years then you do need to
understand and think about these scenarios.
Imagine, though, that you are trying to teach a friend or
one of your children how to build their first simple application – and they are
new to programming. Variables, if-statements, loops, and plain old HTML
are still concepts they are likely grappling with. Classes and objects are
concepts they haven’t even heard of yet. Helping them get a scenario like below
up and running quickly (without requiring them to master lots of new concepts
and steps) will make it much more likely that they’ll be successful – and
hopefully cause them to want to continue to learn more.
One of the things we are trying to-do with WebMatrix is
reach an audience who might eventually be able to be advanced VS/.NET
developers – but who find the first learning step today too daunting, and who
struggle to get started.
We'll start by adding some HTML content to our page.
ASP.NET Web Pages typically start as just HTML files. For this sample we'll
just add a static list to the page:
Just like with our previous scenario, IIS Express has been
automatically configured to run the project we are editing – and we do not need
to configure or setup anything for our web-server to run our site.
We can press “F12” or use the “Run” button in the Ribbon
toolbar to launch it in the browser. As you’d expect, this will bring up
a simple static page of our movies: