SKCL Infinite towers, 9th Floor A21 & A22, Thiru-vi-ka Ind. Estate, Guindy, Chennai - 600032
+91 (44) 2250 1116


ASP.Net Core & Implications to Web Development

ASP.Net Core, previously known as ASP.Net vNext is an open source, cross-platform, and modular web framework which was first released by Microsoft in June 2016. The ASP.Net Core Framework connects the two previously separate frameworks of ASP.Net MVC and ASP.Net Web API into a single programming model along with ASP.Net web pages.

ASP.Net Core 1.0 is not an addition to ASP.Net 6.0 – it is completely a new framework and a fundamental change to the ASP.Net environment. ASP.Net Core framework exists independently alongside ASP.Net and is a leaner, smaller, and modular framework. It is a web framework that has been optimised for the cloud and can run on Windows, Linux, and Mac. ASP.NET Core is not based on the System.Web.dll. Rather, it is based on a set of granular and well-factored NuGet packages. This makes it possible to optimise the applications to include only the required NuGet packages. The modular components of this architecture minimise the overhead while still providing us the flexibility in building solutions which will be especially useful for applications that run on the cloud.

Side-by-Side Versioning:
ASP.Net Core supports side-by-side versioning, meaning that we can have more than one version of .Net residing in the same machine. For example, one application can be built using ASP.Net Core 2.0 and another application can be built using ASP.Net Core 1.1 in the same machine. This was not possible earlier with the ASP.Net framework where we cannot have two applications running on different versions; for example, ASP.Net .4.5 and ASP.Net 4.6 residing in the machine. And whenever we move to a new version of .Net framework, it breaks the web applications using the older version of .Net. This migration problem is resolved in ASP.Net Core framework.

Host-Agnostic Framework:
ASP.Net Core is also a host-agnostic framework, as it uses the OWIN standard (Open Web Interface for .Net) which decouples the link between ASP.Net web applications and the IIS Web Server by providing a standard interface. So now it is possible to develop web applications for non-windows platforms like Linux and also host them on web servers other than IIS like the XSP web server which runs on Mono runtime (Xamarin).

Dependency Injection:
Dependency Injection is a concept which helps to create loosely coupled code and reduces the dependency of classes over other classes. Though the ASP.Net MVC did have some support for Dependency Injection (DI), it did not come out of the box, and required manual configuration by the developer. The DI support also did not extend outside of the MVC. However, ASP.Net Core comes with an inbuilt container which provides strong support for DI.

When we build loosely coupled code through DI, we reduce the dependency between different components and it is easy to modify the code. Loosely coupled code leads to better extensibility, testability, and maintainability.

Core Tooling:
The .Net Core tools are supported in Windows, macOS, and Linux. The .Net Core tools include new Visual Studio templates for .Net Core, Asp.Net Core, Visual Studio for Mac, Visual Studio for UWP, etc.

Integration Testing:
In ASP.Net Core 2.1, a new package has been introduced that streamlines the integration test creation and execution. Integration tests evaluate an application’s component at a much broader level than unit tests. The new Microsoft.AspNetCore.Mvc.Testing package supports testing with a test web host and an in-memory test server. A test project is used to contain and execute the tests. The test project has a reference to the tested ASP.NET Core project, called the System Under Test (SUT). The test project builds a test web host for the SUT. the test project uses the test server client to handle requests and responses to the SUT. A test runner executes the tests and reports the final test results.

Data Protection Regulations Support:
ASP.Net Core offers APIs and templates to meet the General Data Protection Regulation (GDPR) requirements. The project templates include extension points and stubbed markup which we can replace with our privacy and cookie use policy. The cookie consent feature can be used to track consent from the users for storing personal information. If the user does not agree for the data collection and if the application is set with CheckConsentNeeded to true, then the non-essential cookies will not be sent to the browser. Only Essential cookies are sent to the browser when the user has not consented, and tracking is disabled.

SignalR, an ASP.Net Core library, simplifies the process of adding real-time functionalities to web applications. It enables server-side code to push content to clients instantly. It is helpful for applications that require high frequency updates from the server. Examples include gaming, social networks, voting, and GPS applications. It is also useful for Dashboards and Monitoring applications and Collaborative applications like whiteboard applications and team meeting software. SignalR handles connection management automatically. SignalR enables broadcasting messages to all connected clients or groups of clients simultaneously and is scalable.

Other Features:
ASP.Net Core also integrates well with popular client-side frameworks including Angular, React, and Bootstrap. Other features of Core include support for Razor Pages, Razor markup, Tag Helpers which can be used to write integration tests using TestServer, model binding, and validation.

Choosing between ASP.Net and ASP.Net Core:
ASP.Net Core is ideal when you are building a new web application and targeting it across different operating systems. ASP.Net Core is a framework which isn’t fully mature yet, also ASP.Net MVC maybe a better choice if you need a stable development environment.

If you are enhancing an existing application, ASP.Net would be a wise choice.  And if the application is more client-side focused, ASP.Net Core would fit better, as it provides a lightweight and clean implementation of Web API.  At the end, a business cost-benefit analysis can be done to justify the migration to any new framework.