The 411 on ASP.NET MVC 5

As a developer at Innate, I have had the opportunity to work with ASP.NET MVC5 intimately as we are using this framework for one of our larger development projects and it’s helping us create websites with an emphasis on clean architecture, test-driven development and extensiblity.

Firstly, let me explain what ASP.NET MVC stands for: It’s a Model-View-Controller technology and is a framework for building scalable, standards-based web applications using well-established design patterns and the power of ASP.NET and the .NET Framework.

Model-view-controller pattern proposes three main components:

  1. The “model” represents the logical structure of data in a software application and the high-level class associated with it. This object model does not contain any information about the user interface.
  2. A “view” is a collection of classes representing the elements in the user interface.
  3. A “controller” represents the classes connecting the model and the view, and is used to communicate between classes in the model and view.

It also gives native support for JavaScript libraries to build multi-platform CSS and HTML5 enabled sites with better tooling support. This way, we can include attachments (like Certification of Insurance or an EMC letter) to confirmation emails in HTML 5.

By using MVC architecture, Innate can create the required API Keys, enable localizations and make a number of other validations. For example, when a customer needs to receive their Confirmation Email after purchase, we send a request in Postman with the help of their policy ID.  First, the request hits the ConfirmationEmail action on the controller and then controller decides which model to use and then it connects with the view. The web page is then sent as an output via Views in HTML format. Finally, we attach the confirmation email content to that policy holder’s email address and send it to their inbox.

New Features:

With this newest release of ASP.NET MVC5, there are a number of new features that have been added to the framework and they are as follows:

ASP.NET Identity

This is used for authentication and identity management. Nowadays we are using social identities from various social channels like Facebook, YouTube, Twitter, and more to sign into additional accounts and websites. ASP.NET Identity is a new Membership system that was created to handle authentication and authorization for a variety of clients in addition to using the person’s existing social identities.

Authentication Filters

Microsoft explains this feature as, “…a new kind of filter in ASP.NET MVC that run prior to authorization filters in the ASP.NET MVC pipeline and allow you to specify authentication logic per-action, per-controller, or globally for all controllers.”

Filter Overrides

With MVC5 you can now “override which filters apply to a given action method or controller by specifying an override filter. Override filters specify a set of filter types that should not be run for a given scope (action or controller). This allows you to configure filters that apply globally but then can exclude certain global filters from applying to specific actions or controllers.”

Bootstrap integration

Additionally, in MVC5, Microsoft added, “the project template has been updated to use Bootstrap to provide a sleek and responsive look and feel that you can easily customize.”

Attribute Routing

Attribute Routing is now integrated into MVC5. Basically, MVC Routing is better way to create SEO-friendly URLs. If you’d like to learn more about Routing in ASP.NET MVC there are a number of articles online to walk you through it. Attribute based routing enables us to define routes along with action methods as follows:

We also use ASP.NET WebApi 2.2 framework to build Web APIs on top of the .NET Framework. ASP.NET Web API can automatically serialize model to JSON, XML and then write the serialized data into the body of the HTTP response message. In Impulse, with the help of API Keys we send our sessions and quotes to Postman and then we get the response (For example: we get the rates, price details, pdsurl and benefits) in the JSON format.

[Photo credit: Unsplash]

Monisha Vasu

.NET Developer

Monisha is a Software developer at Innate. She is originally from Chennai, India and graduated with an M.S. in Computer Engineering from Syracuse University. She loves traveling, photography, connecting with people and cooking.

Scroll To Top