Programming in ASP.NET: evolution and advantages for the web
Matteo Migliore

Matteo Migliore is an entrepreneur and software architect with over 25 years of experience developing .NET-based solutions and evolving enterprise-grade application architectures.

He has led enterprise projects, trained hundreds of developers, and helped companies of all sizes simplify complexity by turning software into profit for their business.

ASP.NET MVC and ASP.NET Core have become increasingly powerful and versatile technologies, remaining a pillar of enterprise application development.

But you may have asked yourself, why invest time and money in developing something that should be dead and overtaken by client frameworks like Angular or React by now. Right?

The fact that Microsoft is investing much more in the development of ASP.NET Core today than in previous years is certainly a sign to be taken into great consideration. Unless they've lost their minds, don't you think?

Do you want to know which mistakes have allowed us to successfully develop applications with ASP.NET software in .NET for 20 years now?

What can you develop with ASP.NET Core?

ASP.NET Core today is even more powerful and versatile, the 3 pillars of web applications can be developed:

  1. REST API backend that allows you to manage, validate, protect and save data and ASP.NET Core does this job really well.
  2. SPA applications, in which the user logs in and enters our fabulous client-side world, with React, Angular, Vue or any other framewok if a new nerd developer from Nebraska invents them, they need a server system that delivers JavaScript, CSS and HTML files, manages authentication, compression, cache etc...
  3. Frontend, public sites with ASP.NET Core: there is still a very large portion of web applications, which are what are mistakenly called "showcase sites".
    A term that horrifies me, because whatever the purpose of a site, it certainly cannot be to invest time and resources in it and then be left there and have no purpose other than being "seen".

The giant strides of ASP.NET Core

ASP.NET Core has made great strides in every way, evolving ASP.NET MVC and Web APIs into a single ecosystem.

But to properly exploit a new technology you have to be very careful about the choices you make.

I want to give you an example. In 2002 I started developing our own CMS with ASP.NET WebForms and a client-side system in JavaScript, at a time when WordPress and other platforms did not yet exist.

This system allowed the user to drag & drop visual elements to compose the company website and insert content independently, to create the graphic interface of the different sections, insert texts and everything needed to create eye-catching graphics.

The customer had the possibility to choose from a wide range of element types, he could insert registration forms, news sections, images, product lists, product sheets, etc... in short, everything necessary to transform his site into a money machine.

The system we had developed was called Hyperion CMS, it had become a real gem, which we have sold to hundreds of companies over the years.

From the beginning, I and the developers on my team have rigorously evolved it, meaning we have continued to update it, add user features, make it faster, improve its architecture, and replace old technologies with newer ones, all while we were selling of course.

Updating technologies is an exceptional boost, if you know which ones to choose and avoid the adoption errors that often destroy projects. And believe me, it's not that uncommon, in fact, 80% of projects fail within the first 5 years precisely because big mistakes are made that slow down or completely stop development and in the meantime a more aggressive and fresher competitor arrives who develops the same software as yours, but done better and faster.

It happens because new companies and new teams study the software on the market, register for trials or ask some of their customers for access to understand how it works. And then they avoid all the mistakes you made.

This way it is much simpler, writing a system from scratch is always easier, at the beginning, than maintaining an existing one. This is why the most extraordinary skill you need to learn is the art of adopting new technologies and raising the bar on all the features of your software, without ever losing sight of your users.

Making good use of technology makes the difference between increasing the productivity of the team and the quantity and quality of features that can be published for users, as well as improving the user experience, and instead getting into quicksand from which you will never escape, slowing down development and sometimes seeing the system explode in your hands!

To learn how to use ASP.NET Core effectively and avoid errors that can compromise your project, discover the ASP.NET course.

Choosing the wrong technology with .NET

The wrong technology can destroy your project

I'll give you an example to help you understand better what I mean.

Silverlight arrived on September 5, 2007, do you remember it?

On that occasion, as in hundreds of other cases, I had to make a complex and delicate choice.

I had to decide whether I was going to take that ship, based on all the evaluations I had done, or not.

I had evaluated the opportunities of that new technology:

  • how it would impact our productivity
  • the advantage of using a single language
  • the possibility of implementing the MVVM pattern
  • the possibility of using a language to develop the UI, XAML, which is more robust than HTML, CSS and JavaScript

In the end, I decided not to use Silverlight, essentially based on two factors, which I always evaluate when choosing a technology:

  1. How many developers/designers are on the market who know it
  2. What will be its possible evolution and duration in years

I created a checklist of more than 20 factors that I always use to make a technology choice, which I have refined over more than 20 years of software development together with my partners and my team.

We constantly refine it, it is made of trials, errors, field tests, experimental projects and lots and lots of experience.

You too often find yourself having to make these assessments, and a mistake in this case can cost you very dearly.

A few years ago, in 2010 more precisely, a scenario occurred which was then repeated in many companies for which we advised, when the damage had already been done, because they had made wrong choices.

For example, I consulted for a company that produces a very well-known software in Italy, 2 years before I met them they had made the mistake of choosing Silverlight for the development of the web version.

They paid for this mistake by having to employ 2 full-time developers on an already dead project, because they already had many active customers on the Silverlight platform, but at the same time they needed to start development on ASP.NET MVC as well, to also have a version that would last for years.

In fact, Microsoft had announced the death of Silverlight in the meantime.

This company is quite large and structured, but not everyone can afford a similar mistake, especially in small to medium teams like the Italian ones. Here in Italy a team of 10 people is already quite large, while abroad there are teams of 500 people.

If you don't have a team of 500 people, you have to be very careful about the choices you make, because if they lead you astray your software could be doomed!

Furthermore, there is a big danger, very insidious, much more than the choice alone, which can screw up your project: implementing the solution with "your systems" and stuffing it with anti-patterns.

Do you know how many times I've heard "we developed the our data access system"? And my reaction has always been this 🤦‍♂️. Because I've seen some rubbish, code so intertwined that, you know spaghetti carbonara, here are nice full plates.

Spaghetti code in .NET

Things that only a twisted mind can give birth to, and do you know why such abominations emerge? Why they come from developers who don't train and they invent their own solutions.

Yes, spaghetti carbonara is delicious, but don't get distracted by writing spaghetti code, it's not good!

In ASP.NET course Let's see how to adopt technology without risk and how to design applications that really work.

Why ASP.NET Core is the right choice

ASP.NET Core has been lightened, componentized with Nuget in all its functions, from HTML rendering to security.

They optimized its performance, so much so that today it is one of the fastest environments ever.

It is multi-platform and therefore can run on Windows servers as well as on Linux, and if desired also on Mac. And this is a huge advantage, not that it can run on Mac, at least not ASP.NET Core, but on Linux, lighter servers whose hosting costs less even on Azure.

They integrated the management of the UI with Razor and the API with the controllers, making everything uniform and easy to test, thanks to a great work of separating dependencies, now everything is an interface (C#).

The power of ASP.NET Core is also the integration with 3 fundamental systems for developing quickly and without stress:

  • Visual Studio as an IDE
  • DevOps to manage the code under TFS or GIT and the project
  • Azure to deploy applications and exploit the cloud with ease

A quick quick note: releasing ASP.NET applications has become really simple, you can use manual publishing from Visual Studio or you can launch it automatically from DevOps when you check in on TFS or commit on GIT.

Let's see in detail how you can make the most of each of the three systems I talked about just now.

1. REST API backend

As I told you earlier, ASP.NET Core has integrated the MVC part with the Web API, which is why the MVC suffix is no longer there.

No more regressions and endless headaches!

You can access data with very fast technologies, such as Entity Framework Core, Cosmos DB and reading with Dapper, a very lightweight but high-performance framework.

You can implement CQRS to separate the reading part from the writing part, and make your API layer super performing and easy to maintain thanks to the wise use of dependency injection and unit tests.

With ASP.NET Core validating the data, i.e. the commands, passed as parameters in the PUT, POST and DELETE methods, becomes child's play. The Nuget FluentValidation package allows you to use conventions to apply the validator, a C# class with automatic definition of rules via a fluent interface.

And return a 400 (BadRequest) error with validation errors in JSON as a response, so the client has feedback on what isn't working.

Authentication and authorization can be implemented in many ways, with OAuth, OpenId, Identity Server and guarantee secure access to your APIs, with the management of permissions and roles.

With unit tests, integration tests and a framework like SharpTestsEx

With ASP.NET Core and Azure you can create an infrastructure without limits, there are various services that you can use to run your applications, such as App Services and Azure Functions.

The Functions allow you to create an even more modern and scalable architecture, without servers and with the possibility of truly widespread deployments, even wanting one for each endpoint.

So in summary, with ASP.NET Core you implement all the crucial aspects with solid and tested frameworks and patterns, which allow you to design and compose your architecture without ever having to reinvent the wheel and find yourself in trouble at some point.

In particular:

  • Data access, reading and writing via ORM and framework
  • Automated data validation
  • Authentication and authorization
  • Unit testing
  • Publishing and continuous deployment

2. SPA applications

You can't do everything with a server-side framework, right? Web applications have now exploded, it is possible to create increasingly complex applications, with almost all the functions of desktop applications.

The various frameworks such as Angular, React and Vue, thanks to the separation of layout and application code, allow us to write the new Gmail and Facebook, do you agree?

However, they need a web server that provides the HTML code, CSS, JavaScript files, images and in general all the static resources.

3. Public sites with ASP.NET Core

They can be used by your company or your customers to communicate with visitors who are not yet customers but to whom you want to provide free content or services to attract them and introduce them into the so-called funnels.

That is, bringing them to a squeeze page where they enter their data, in particular name, surname and email, to be able to send them emails, offers, information content and track them with remarketing and retargeting systems, such as Google Ads and Facebook.

Do you know what monster can devour your efforts to develop a system that generates leads: the potential customer who leaves you his data?

Well, more than just one monster, we can talk about a Hidra, do you know the legendary multi-headed monster in which you have to defeat all the demons it is made of, in order to emerge victorious from the battle? In this case there are at least 3 heads to be cut.

The slowness: it is the first real bugbear of every developer, because even if the system seems fast during development, and on your own PC ("Works on my machine" syndrome), with a user, everything goes smoothly, when you go into production and publish the site, perhaps on Azure to exploit the power of the cloud, it starts to be used and leaks everywhere, has this ever happened to you?

Or, the site runs fast even in production, but then starts to slow down inexorably, and from the Ferrari it was, it transforms into a Panda made of sheet metal, with the added bonus of a big catch, it does it like the faces in morphing programs, with a degradation so slow as to be imperceptible, until one day you realize that you have gone from 250ms of loading a page, a result that made you as proud as the knight of the Templar order, to 10 seconds, a worthy result of the speed with which Morla, the thousand-year-old turtle in "The Neverending Story", spoke.

Slow site

2) Unhandled errors: you know those nice pages for managing 404 errors or worse, 500 errors, where there are little monkeys banging the plates and saying "Oops, something went wrong" or Homer exclaiming D'Oh?

Well, users hate them! They don't find them nice or even intelligent. They only denote poor professionalism and little organization in correcting errors, which obviously can happen and it is impossible to have 100% bug free software, but you have to manage them correctly in two ways:

  1. Logging all exceptions, .NET and JavaScript, on a cloud tracking system that allows you to always be one step ahead of the user and know all the problems with your software.
  2. Have an error interception system that allows you to redirect the user to a useful resource in the case of a 404 and to a help page in the event of another type of error.

3) Non-responsive layout: this problem is unforgivable today, you know, users visit sites (also) from mobile, soon phones will be more powerful than PCs and they already have better screens. Ignoring mobile traffic is a gross mistake, you cannot fail to consider it adequately.

Here too, if you use Boostrap and ad-hoc design for mobile correctly, you solve it very well at the beginning, but problems can arise later, because it is easy to create responsive sites at the beginning, but then with the increase in pages and different layout configurations, an adaptation of the CSS for some scenarios can break it in other points.

The solution in this case is to carry out manual tests, UI tests, use tools such as Google Search Console which perform automatic analysis of phone navigability and behavioral analysis.

If you want to develop web applications with ASP.NET Core and achieve concrete results, sign up to course on ASP.NET.

Three mistakes you make in ASP:NET

Contact us to help you defeat the multi-headed monster and avoid fatal mistakes, thanks to our course on ASP.NET we will support you to win this difficult but exciting battle.

Leave your details in the form below

Matteo Migliore

Matteo Migliore is an entrepreneur and software architect with over 25 years of experience developing .NET-based solutions and evolving enterprise-grade application architectures.

Throughout his career, he has worked with organizations such as Cotonella, Il Sole 24 Ore, FIAT and NATO, leading teams in developing scalable platforms and modernizing complex legacy ecosystems.

He has trained hundreds of developers and supported companies of all sizes in turning software into a competitive advantage, reducing technical debt and achieving measurable business results.

Stai leggendo perché vuoi smettere di rattoppare software fragile.Scopri il metodo per progettare sistemi che reggono nel tempo.