Skip to content

Revealing the “Hot-Spots” Of ASP.Net Core 1.0 – The Future of ASP Technology

Featured Image

In the world of competition, Microsoft has always chosen to be a step ahead. This time Microsoft has taken a move towards going open source. The .Net development field is buzzing with the new version of .NET. The new version was supposed to be called as ASP.NET 5, but as this version would be complete restructuring of the framework instead of upgrading, the name has been renamed to ASP.NET Core 1.0. This version comes with lot of performance improvements and new features. So, let us have a look at the ASP.NET Core 1.0 Roadmap which is queued up for the further release.

What’s new with ASP.Net Core 1.0?

You must be excited to know its features, right? So, presenting below top features of the future release ASP.Net Core 1.0:

1) Net going to be compatible with OSX and Linux:

Isn’t it great news?? I think, you must have never thought that ASP.Net could run on any other platform except Windows. But this is true!! First time in the history of the ASP.Net, you can successfully run ASP.Net Core 1.0 applications on OSX and Linux along with Windows.

Enabling the ASP.Net Core 1.0 on these three platforms- Windows, OSX and Linux can help you to change everything. The developers and designers are able to build their apps with ASP.Net Core 1.0 while using their favourite development environment like the Sublime Text and WebStorm when working with ASP.Net Apps.

2) GruntJS, NPM and Bower Support:

There are a number of things to explore with the front-end development in ASP.Net Core 1.0 with the support of GruntJS. Basically, GruntJS is a task runner that enables you to build front-end resources like the JavaScript and CSS files. Thousands of GruntJS plugins are available that helps you to handle variety of tasks. Roughly stating, at present there are 4,334 plugins listed in the GruntJS plugin repository.

Further, in order to support GruntJS, Microsoft needed to support two new package managers-

  • Firstly, as the GruntJS plugins are distributed as NPM packages, so Microsoft added support for NPM (Node Packet Manager) Packages.
  • Next thing, due to a number of client-side resources, like the jQuery, Twitter Bootstrap, Polymer and AngularJS as well, these were distributed through Bower and thus Microsoft added a support for Bower.

Ultimately, the main thing to consider is that you can run the GruntJS using different plugins from the NPM as well as client resources from Bower.

3) The MVC and Web API Specifics

  • Unified MVC and Web API Controllers:

If you are a hard core ASP.Net developer, you must have an idea that the MVC controllers and the Web API controllers were different in previous versions. For MVC controller, System.Web.MVC.Controller base class was used and for Web API controller System.Web.Http.ApiController base class was used.

In ASP.Net Core 1.0 version, instead of using two base classes, there is only one Controller class treated as base class for both MVC and Web API controllers- Microsoft.AspNet.Mvc.Controller class. As a result, it can be said that in MVC 6, both MVC controllers and Web API controllers use the same routes. So, you can either use convention-based routes or the attribute routes in a project.

  • View Components:

In the previous ASP.Net MVC versions, the subcontrollers were used which are now replaced by the View Components. View Components are a great source for rendering chunks of view which have a complex logic behind it, rather than a whole response. As it includes the same separation-of-concerns and testability benefits like that found between controller and view, you can solve any of the problems that you find too complex to handle. Some of the best examples for these view components can be login panel, shopping cart, dynamic navigation menus, sidebar content on a typical blog, tag cloud, recently published articles and many more. A particular view component is being derived from the ViewComponent, by decorating the class with the [ViewComponent] attribute or just by convention ending the class name with ViewComponent.

For an instance- a view component created for login panel that would be displayed on every page must have following functionality:

  • If user is not logged in, then login panel is rendered
  • If user is in admin role, then admin panel is rendered
  • If user is logged in, then the links to log out and manage account are rendered.

Briefly stating, any complex module can be easily divided into several chunks as view components, coded, tested and then successfully integrated with the whole programming logic.

  • Tag Helpers:

The Tag Helpers is one of the best features that enable the server-side code for participating in creating as well as rendering the HTML elements in the Razor files. There are a number of built-in Tag Helpers for carrying out common tasks, which includes creating forms, loading assets, links and even more that are available in the public GitHub repositories and NuGet packages.

4) Injecting Services:

The ASP.Net Core 1.0 supports dependency injection into views. This feature is more useful for some of the view-specific services that include data required only for populating view elements or localization or separation of concerns between controllers and views and many more. Majority of the data that your views display must be passed in from the controller.

5) Performance Response Cache:

The Response Cache refers to the cache-related headers on the HTTP responses that is being made by ASP.Net MVC actions. It helps you in specifying the cache responses for the client as well as intermediate or proxy machines itself. Besides that, it reduces the number of request a client or proxy makes to the web server.

There are three common directives for primary HTTP header caching, namely- public, private, no-cache. Besides that, there are number of ResponseCache attributes that includes- Duration, Location, NoStore, VaryByHeader, CacheProfileName and Order. All these makes better performance for the ASP.Net modules.

6) Security- Enabling Cross-Origin Requests:

In ASP.Net Core 1.0, the same-origin policy is restricted where the browser security prevents a web page from making AJAX requests while preventing malicious site from reading the sensitive data from another site. As a result, it allows Cross Origin Resource Sharing.

The Cross Origin Resource Sharing (CORS) is a W3C standard that allows the server to relax with same origin policy. With the help of CORS, a server can easily explicitly allow some of the cross-origin requests and reject other unnecessary requests. Briefly stating- CORS is safer and more flexible as well as compared to the earlier techniques.

This was the first impression and the main highlights of ASP.NET Core 1.0, we may get more surprises once Microsoft releases ASP.NET core as it is still under development.

Related Insights