Let's talk about ASP.NET Core
The .NET Framework Lore
So, in the late 1990s Microsoft began working on it’s so
called “.NET Strategy.” The idea behind the project was meant to encompass all
Microsoft products and add the .NET ending to the already existing product
names. Back then the .NET framework was known as the “Next Generation Windows Service,”
or NGWS in short. Since the initial .NET strategy failed, the NGWS name was
dropped and has now been known as the .NET Framework instead.
The first beta version of the .NET Framework was released
around the year 2000. The reason for its development was to compete against Sun’s
Java which was the sole dominator in the software development industry at the
time.
The first solid version of the .NET Framework was released
around 2002 named .NET 1.0 with its main feature being the Common Language
Runtime (CLR) as well as providing support for the object-oriented development
of web apps.
Fast forward to 2014, at this point, .NET has had a lot of
upgrades to its functionality including things such as support for AJAX,
dynamic data handling, ASP.NET MVC, and many more. Although it had many
advantages, the biggest flaw it had was that it was only able to work on the
Windows platform as a closed source software. To address this problem, Microsoft
announced .NET Core: a cross-platform, open-source re-build of
the .NET Framework.
.NET and ASP.NET, What’s the
Difference?
First off, .NET is a developer platform which is
made up of various tools, programming languages, as well as libraries for developing
different type of applications. The base platform includes components that can
be used for various apps.
ASP.NET on the other hand is just an extension of
the .NET platform, it adds more tools and libraries specifically for building
web apps. ASP.NET allows developers to create web pages with a templating
syntax known as Razor, which is basically just HTML and C#.
TLDR: .NET itself is a developer
platform and ASP.NET extends the .NET framework.
So, What is ASP.NET Core?
ASP.NET Core is a free, open-source web framework provided by Microsoft for building modern cloud-based web applications. The great thing about ASP.NET Core is that it is cross platform which means that it can run on Windows, Linux, MacOS, as well as Docker! While ASP.NET is a framework more specifically for web application development, with .NET, tech savvy individuals can build their own web apps and services, IoT apps as well as mobile backends.
ASP.NET
is what we call an end-to-end solution which means it runs the back end as well
as the front-end (this is called a Full-Stack environment). When using
ASP.NET, the backend code such as business logic and data access are all written
using C#, F#, or Visual Basic. Since ASP.NET extends .NET, there is a large
ecosystem of packages and libraries at the developer’s disposal.
As
mentioned above, ASP.NET uses a templating syntax known as Razor which
uses HTML as well as C#. the Razor syntax provides a way for developing dynamic
web pages with the C# code being evaluated on the server side and the resulting
HTML content sent to the user end. Code that is executed in the client side is
written in JavaScript. ASP.NET is able to integrate with JavaScript frameworks
and includes pre-configured templates for Single Page App (SPA) frameworks such
as React and Angular.
![]() |
The Razor Syntax as shown. The @ symbol helps transition from HTML language to C#. |
ASP.NET
allows developers to create web applications including web pages, REST APIs,
microservices, and hubs that push real-time content to clients that are
connected.
Why should I, as a Developer
Bother with ASP.NET Core?
First and foremost, one of the reasons why ASP.NET has
become so popular within the software development industry is because of its open-source
nature. The framework code is available on GitHub where anyone is free to
modify, review, or contribute to the code. With numerous developers working together
to improve the code, bug fixes and new releases are quicker and are released on
a regular interval. Freedom to add framework components, libraries, etc.,
depending on project requirements is another positive aspect.
Another reason why ASP.NET is such a popular tool for
developers is because of its high performance. ASP.NET applications are
compiled which means that the code is translated into object code which is then
executed. After the compilation process, which does not take that long, the
code can be executed over and over by the .NET platform efficiently and
quickly.
Interpreted code from languages such as PHP, JavaScript and
Ruby are not directly executed by the machine, but instead must be read and interpreted
every time before it is executed. Compiled code on the other hand is usually
faster and more scalable all while being able to do what interpreted code can
do.
The compilation process also helps developers with validating
code consistency. For example, if a method name were to be renamed, any
reference throughout the rest of the application would show an error during
compilation, which makes identifying and fixing the errors way easier. Interpreted
languages would not be able to identify this error until the code is actually
executed and tested. When working with a large application, it makes sense how
compiled code (ASP.NET applications) can be more efficient than interpreted
code (PHP, JavaScript, etc.).
The ASP.NET framework is fast and reliable all while producing
responsive outcomes. The dynamic user experience along with a good and flexible
process leaves users satisfied with the results.
There are many other reasons why it is worthwhile learning
more about the .NET framework but in the meantime, these are just some of the aspects
to consider.
How to Start With ASP.NET Core
There are many different IDEs out there that can be used to edit code for building ASP.NET web applications but for now I will only be referring to Visual Studio and Visual Studio Code.
When working on the Visual Studio IDE:
- The ASP.NET web development workload must first be installed.
- Start up Visual Studio and Select “Create New Project.”
- After that, a list of templates will then be presented to you, select ASP.NET Core Web App (Model-View-Controller).
- Give it a suitable name for whatever project you want to start.
- Go to the next page and make sure the framework is set to the (Long term support) version and create.
When working on
the Visual Studio Code IDE:
Using Visual Studio Code as the IDE for building an ASP.NET web app requires some knowledge on the .NET CLI commands.
- The latest version of C# for Visual Studio Code as well as the .NET 6.0 SDK must first be installed.
- On the command line, switch to the directory of the folder you want to create the project in.
- Type out the command:
- After creating the project, switch directories so that the command prompt is located in the project folder. To run the project, enter the command:
- The command line will then begin to build the project and create a localhost for the project to be run on. Navigating to this page will show the default interface for the .NET project.
- This project can be opened and modified in the Visual Studio Code IDE.
Final Thoughts
I am still very much learning more about this framework so there may be some discrepancies with the information written on here. From what I have learned so far, ASP.NET Core is a great tool for creating dynamic web applications using an interesting templating syntax, Razor. I have started to work on my own projects using Visual Studio but not yet enough to provide my own opinions and feedback on it. Any feedback from readers will be much appreciated and I will try my best to learn from them.
Video Presentation:
“What is ASP.NET?: .NET,” Microsoft. [Online]. Available: https://dotnet.microsoft.com/en-us/learn/aspnet/what-is-aspnet. [Accessed: 15-Jun-2022].
M. Wiseley, “What is ASP.NET and why should I use it? - wakefly blog,” Wakefly, Inc., 27-Nov-2018. [Online]. Available: https://www.wakefly.com/blog/what-is-asp-net-and-why-should-i-use-it/. [Accessed: 16-Jun-2022].
Maitray-Gadhavi, “Top 8 reasons why ASP.NET core is the best framework for web application development,” Radixweb, 08-Dec-2021. [Online]. Available: https://radixweb.com/blog/8-reasons-asp-dot-net-core-is-best-framework. [Accessed: 16-Jun-2022].
Rick-Anderson, “Get started with ASP.NET core MVC,” Microsoft Docs. [Online]. Available: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-mvc?view=aspnetcore-6.0&tabs=visual-studio-code. [Accessed: 16-Jun-2022].
Comments
Post a Comment