Core
Core
NET Core
ASP.NET Core is a cross-platform, high-performance, open-source framework for building modern,
cloud-based, Internet-connected applications. The latest version right now is ASP.NET Core 6.0 and is
based on .NET 6.0.
Both are Open-source and Cross-platform. Works on Windows, Linux and macOS.
Platform Independent i.e., ability to develop and run-on Windows, macOS, and Linux.
ASP.NET Core MVC is Microsoft’s Web Application development framework that is in great demand
today. It is based on Model-View-Controller (MVC) architecture, ideas and techniques from Agile
Development, and the best parts of .NET platform.
Before ASP.NET Core, Microsoft already had 2 other similar frameworks, these were – ASP.NET Web
Forms (popularly known as just ASP.NET) and ASP.NET MVC. Let us discuss how ASP.NET Core is
different from them.
ASP.NET Core was released in the year 2016 and is based ASP.NET Web Forms known as just
on .NET Core framework (now known as just .NET). Latest “ASP.NET” is a web application framework
version right now is .NET 6.0 which was released in released way back in 2002. It is based
November 2021. on .NET Framework.
ASP.NET Core apps can be hosted with several web ASP.NET Web Forms apps can only be hosted
servers like IIS, Kestrel, Nginx, and Apache. with IIS.
ASP.NET Core is based on .NET Core ASP.NET MVC is based on .NET Framework. It’s first version
framework (now known as just .NET). First came in 2007 while the last version which is ASP.NET MVC
released during 2015. 5.0 came in 2016. MVC 6 was abandoned due to .NET Core.
Apps are light weight. Apps are relatively heavy compared to ASP.NET Core apps.
It is Opensource
You are free to download this framework’s source code from https://github.com/aspnet and even
modify and compile your own version of it.
Cross-Platform
ASP.NET Core MVC is cross-platform both for development & deployment. It is available for all
operating systems – Windows, Linux & macOS.
You can do development works in ASP.NET Core MVC using Visual Studio editor by Microsoft. Visual
Studio works only on Windows & macOS.
Similarly, you get full control over HTTP requests passed between the browser and server. Creating AJAX
request is also very easy.
You can easily use client-side libraries like jQuery, Angular, React & Bootstrap with ASP.NET Core MVC.
Extensible Framework
ASP.NET Core MVC is highly extensible. You can make applications that can be extended to any levels in
future. Key features of this framework that gives it the extensible power are:
1. View Components
2. Tag Helpers
3. Routing
Routing
ASP.NET Core MVC “Routing” makes SEO friendly URL which are easy to make and can be controlled
from a single place. This removes the probability of error.
You don’t have to hard core the URL, instead the Routing will make it for you based on the structure
which you have set.
1 /women-clothing/skirts/
API
ASP.NET Core MVC APIs can take full advantage of language and runtime innovations familiar to C#
programmers, like the await keyword, extension methods, lambda expressions, anonymous and
dynamic types, and Language Integrated Query (LINQ).
Model – It contains the data for the application to work with. This data is provided to the Model
from the database or any other repository.
View – It forms the User Interface (UI) and is rendered on the browser. Views contains HTML
layouts which the user sees on the browser
Controller – Controller is the brain of the MVC application. It processes the incoming request to
the application, performs operations like data filling, data update, data delete, data inserts, etc.,
and finally renders an appropriate View to the browser based on the request.
MVC Models
Taking an example of a social community website like Facebook, a Model will contain all your details like
– your name, ages, status, work info, your posts by date, your comments done on other profiles, your
messages to other people, your liked pages and so on.
These details (your data) are filled on the Model by the Controller.
Models also help in preserving the business logic of the application (here for Facebook). For example,
when running paid ads in Facebook, Models will not allow you to add invalid amounts on the ads.
Example – ‘some amount’, ‘thirty’, ‘hello’ etc. It will also only proper amounts like ‘$10’,’£20.50’, ‘$100’,
etc.
MVC Views
Views are the User Interface (UI) in MVC and are rendered on the browser. They can contain static
HTML or dynamic HTML sent by the Controller. Views communicate only with the Controllers and not
with Models.
Controller is responsible for rendering a particular View based on the request it gets from the browser.
MVC Controllers
Controller is the main thing in MVC. It sits between the View and the Model and communicates with
them. All HTTP requests are received by the Controller, which after processing it, fills the data on the
Model and sends the data on the View. The View is then rendered on the browser.
Controller contains simple to complex logic based on the working of the application.
This will open Create a new project window. Now here select the template called ASP.NET Core Web
App (Model-View-Controller), and then click the “Next” button.
What should I learn before learning ASP.NET Core
Before you start learning ASP.NET Core, you should have a basic knowledge of HTML CSS and C#. HTML
and CSS are used in the Views which forms the UI component of ASP.NET Core MVC. C# is a
programming language to create code logics like communicating with database, searching for a value in
the data, and so on.
Is ASP.NET Core good for my Career? ASP.NET Core is currently in the top 3 – “most demanding
programming technology”. It is a product of Microsoft who entered way back in 2002 with .NET
framework. Twenty years have already passed, so it is a surety that this technology which remain for a
very-very long time. Entry level ASP.NET Core developers are always in good demand and get starting
yearly salaries of around $50k in United States alone. In India the starting salaries are around 4 to 5
lakhs per annum.
Here you have chosen the Model-View-Controller (MVC) Template, so the necessary MVC folders and
files are automatically created by Visual Studio. You can open the Solution Explorer from View ➤
Solution Explorer menu, it will be added on the right corner of Visual Studio and will show all these
files/folders in the newly created app. Had you chosen the other option, which is the ‘Empty’ template
one, then you must create these MVC files and folders one-by-one from the file menu.
MVC files and folders
These are files and folders in your application.
wwwroot – contains the static files like images, scripts, external frameworks and libraries like
Bootstrap, jQuery.
appsettings.json – This file contains configuration settings of the application. You can use it to
store database connection string, application variable values and other informations.
program.cs – It is your application’s entry point which starts when you run your application.
Here you create your application host, choose the web server, add services, authorization, and
authentications.
startup.cs – Note – DOT NET 6.0 does not have startup.cs. If you are using earlier versions
of .NET only then you need to have this file in your app. The startup.cs is called from
the program.cs file. Here you add services and configure the HTTP pipeline. You also write URL
Routes in this file.