Click here to Skip to main content
15,606,446 members
Articles / Web Development
Posted 16 Feb 2016

Tagged as


5 bookmarked

Interesting Features of Web Development with ASP.NET 5

Rate me:
Please Sign up or sign in to vote.
2.13/5 (6 votes)
16 Feb 2016CPOL3 min read
The new ASP.NET 5 and its MVC provides us with some interesting features that change the approach to web development.


Besides the renaming of ASP.NET, introduction of the .NET execution environment, and the overhaul of the whole approach to Web Development in .NET, there are some really cool things that stand out in the ASP.NET 5 MVC. More about the introduction is available here.

ASP.NET 5 and Its MVC Feature

I would like to talk about the following:

  1. Environment
  2. HTML Helpers
  3. Middleware: Popularized by Node.js
  4. Dependency Injection
  5. Configuration Settings


In previous versions of ASP.NET Framework, there has been no way to specify environments you are in. A hack I would normally have is to add the lines below to my config file...

<add key="env" value="dev"/>

...and then check in my code if environment is dev or live or test, but I get this for free in this version of .NET with intellisense support. I can indicate easily which JavaScript I wish to load in development environment and which to load in test environment. This also comes naturally to my code anywhere in the project.

HTML Helpers

Many are already familiar with tags such as:


Watching Scot Hanselman and Glenn Condron go through Introduction to ASP.NET 5, it was fascinating that all you need to be familiar within your View is your HTML 5 and just a few things ASP.NET 5 provides for you out of the box.

Instead of having to remember HTML helpers with all the overloads, what you now have is:

  • Bind the form to a method using asp-action and asp-controller
  • Bind the form controls to the form with asp-for
  • Submit and Model Binding maps the model in the view to the parameter of the Action method annotated with HttpPost


According to Node.js Design Pattern, in the Node.js world, Middleware was popularized by Express. And then, we also have Owin chaining middleware in the Http pipeline. This fantastic feature comes in handy in this new framework. You can Use Run and Build them once you chain them properly.

What a middleware actually does is to pause the request pipeline, in order to enable you to add some more configuration, take some decisions, take actions and either allow before returning or return request. Middleware chaining in .NET 5 is similar to what we have with OWIN. You can have UseErrorHandlers, UseMVC and what have you.

Dependency Injection

This comes with popularity of decoupling application components to facilitate Unit test, enable ease of code change, etc. There are various libraries today available for dependency injection. Unity, MEF, Windsor Castle, Ninject and many more. What these libraries actually offer is available in the new .NET Framework.

My Database Context is easily available and I can just specify what I want to carry about in the DI container.

Configuration Settings

This will be very familiar to folks who have worked in time past with Nodejs. My configuration settings are actually specified in config.json files, I can instruct the framework to look for a particular config file, say config.development.json or whatever. This flexibility is very good for developers. How about User Secrets that prevent you from checking in sensitive information to repositories. This is indeed an amazing feature.

There are so many other features that are available aside the few mentioned above which is taking the face of development to a completely new level.


One thing I look forward in the MVC of this new .NET Framework is modifying the Model Binding Engine, such that I can bind multiple Models to a single view without the use of ViewModels. This is because in reality on a view, you can have multiple models you want to bind separately and use Ajax calls to treat such page sections.

In the near future, I will be comparing this new version of .NET with Nodejs because I see many things adapted from the Node.js world into the new .NET Framework.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer
Nigeria Nigeria
I am a Software Developer with Asp.Net/C# background but with a passionate inclination on software technologies that has challenged our Status quo.

Comments and Discussions

GeneralMy vote of 2 Pin
Member 1233037318-Feb-16 9:44
Member 1233037318-Feb-16 9:44 
GeneralRe: My vote of 2 Pin
_mayowa18-Feb-16 11:02
_mayowa18-Feb-16 11:02 
QuestionNice article, but actually v5/v6 is more complex Pin
GregoryW17-Feb-16 21:23
GregoryW17-Feb-16 21:23 
Hi, thanks for an atricle, please take a look on more changes in v5/v6.

Top 10 Changes in ASP.NET 5 and MVC 6 | Stephen Walther[^]
It's all about the code.

AnswerRe: Nice article, but actually v5/v6 is more complex Pin
_mayowa17-Feb-16 23:50
_mayowa17-Feb-16 23:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.