Comprehensive ASP.net MVC
Comprehensive ASP.NET MVC is an introduction to Microsoft’s ASP.NET MVC web development framework. Assuming no knowledge of ASP.NET or ASP.NET MVC, we will create a data-driven blog engine from scratch. This 14 hour series is all you need to get started quickly with building real, production-ready, web applications using Microsoft’s .NET framework.
Why learn ASP.NET MVC?
ASP.NET MVC is one of the most popular web development frameworks today. It is built and maintained by Microsoft, and provides us with a lean, modern environment for making our web development projects a reality. In addition, the tooling support from Visual Studio is second to none.
Finally, ASP.NET MVC allows us to develop web applications using any .NET language. We will be using the expressive, powerful, and modern language C#. Although there are other web development frameworks available for .NET, ASP.NET MVC is a first class citizen in the .NET ecosystem – giving it a powerful edge over alternatives.
What will we build?
This series is organized in a project-focused manner. We will build up a simple blog engine that supports users, roles, posts and tags.
The straightforward and well understood nature of a product like this allows us to focus on what matters: ASP.NET MVC. Building a complete, production-ready product from scratch makes our content much more interesting and fluid, and, above all else: practical.
What will you learn in this series?
This series goes over the most important features of ASP.NET MVC: routing, areas, asset bundling, controllers, the Razor view engine, data binding and validation. We also will be using the mature and very powerful nHibernate OR/M to access our database; and the Fluent Migrator database migration framework to version our database schema in source control. In this series we also take a look at security issues – from CSRF and XSS attacks, to making sure our errors aren’t displayed to our customers.
Although this is not a frontend web development series, we will be using both jQuery and Bootstrap 3 to substantially speed up our development and provide a modern, sleek, user interface for our product. The foundation we lay can serve as a launching point for your own design needs.
If that isn’t enough, we also take a look at deployment to a real Windows server. In addition to configuring IIS and showing how to run our migrations to populate its schema – we introduce Web Deploy. Web Deploy is a product that allows us to publish our web application right from inside of Visual Studio (or even a command line tool if you wish to integrate this with your Continuous Integration server). We install Web Deploy on the Windows server, show some common pitfalls and get everything up and running from inside of Visual Studio.
What do you need to follow this series?
All code in this series can be written using the free express editions of Visual Studio 2012 or later. The deployment process outlined in this series can be applied to Windows Server 2012 – but can also be used with normal, desktop versions of Windows for development purposes.
We will also be using MySQL as our database. In addition, to manage our database, we use the free MySQL Workbench product that is available via the same MySQL installer that includes the database itself. We assume that Visual Studio, MySQL and MySQL workbench are installed on your machine.
We also assume an understanding of C# up to basic object orientation. We won’t be using any advanced features of the language, except for our limited use of LINQ to query our database.
Welcome! This video talks about what we will cover in this series.
We will introduce GIT to people who haven't used source control before. We only look at the basic features of the product. It's important for people new to source control to watch this, and go through the motions of using it throughout the rest of the series.
We talk about the MVC pattern, why it is useful, and how it applies to web development.
We take a look at ASP.net and how it relates to ASP.net MVC, WebForms, SingalR and WebAPI.
This video shows how to create a project in VS 2015 Community which will be compatible with the rest of the series.
We create our project using the "basic" template in ASP.net MVC and discuss the files that are bundled with it by default.
We add our new project to GIT - and set up up a proper .gitignore for our needs.
ASP.NET MVC Basics
We introduce routes, areas and controllers - and show how we can hook into ASP.net MVC so that our code gets properly executed.
This video is all about views and layouts. We introduce the Razor templating engine and show how we can use it to make our lives a whole lot easier!
This video focuses on how to pass data from controllers into views, and how HTML forms inside of our views can pass data back into our controllers.
We will cover the built in ASP.net authorization and authentication that we can hook into.
This video talks about stylesheets, script files and how we use them in ASP.net MVC. We also show the bundle API - which allows our resources to be processed for production use.
In this video we look at a more advanced example of a Razor layout file.
Working with Data
This video discusses, at a high level, how we will be accessing our data with nHibernate.
We show how to use Fluent Migrator to version our database.
This video introduces the specific components of nHibernate in a high level fashion.
This short video talks about the MySQL Data driver so that nHibernate can properly use our database.
We create our users entities and mappings so that we can use nHibernate to access our users table.
This video shows the creation of our first admin panel. We build the interface that manages our users table.
In this video we hook our users database into our authorization and authentication logic. We also look at how to secure our passwords on our database with hashing.
This video talks about the CSRF attack and how to use ASP.net MVC to prevent it.
This video shows how to present the user with a form that updates a many-to-many association.
We will create our post and tag data models.
This video shows a way to make a listing page on the admin that has pagination.
This video goes over the edit and new forms on our posts model.
This video shows a method for soft deletion for our posts.
This video shows the creation of our post tag editor.
This video shows the SELECT N+1 issue, and how to fix it with nHibernate's eager loading API.
This video goes over adding CKEditor to our project. We also discuss Cross Site Scripting, and how ASP.net MVC can prevent those kinds of attacks.
The first video for building our frontend.
The second, and final, video for building our frontend.
Deploying to Production
This video goes over configuring a Windows Server and setting up Visual Studio to deploy to it via Web Deploy.
We show how to create custom error pages, and handle error logging with ELMAH.
Conclusion to our series.