Skip to main content

ASP.NET Core: Cloud-ready, Enterprise Web Application Development – The Book

After some weeks of delay due to technical reasons the Learning Path edition of my ASP.NET Core and Angular book is finally out throughout the Amazon (and non-Amazon) marketplaces all over the world. The name is ASP.NET Core: Cloud-ready, Enterprise Web Application Development and it comes as part of the Packt Book’s Learning Path series: each of these paths features a different course for readers to give them a one-stop learning experience with different technologies. Needless to say, the course is about a full-stack programming experience with ASP.NET Core, using modern client-side frameworks (such as Angular) for the GUI part.

Here’s the updated cover:

Read More

How to fix the “No executable found matching command dotnet-ef” error in Visual Studio with .NET Core

If you’ve stumbled upon this post it probably means that you’re trying to use Entity Framework Core in a .NET Core Visual Studio project with the dotnet ef CLI or Powershell command, which gives you the following error:

No executable found matching command “dotnet-ef”

This can be a nasty issue due to the fact that the framework gives little or no info, thus it’s not easy to understand what it actually lies under the hood. Luckily enough, there are a few things you can try that will most likely help you to fix that for good.

Read More

PasswordCheck – A small C# class to calculate password strength and implement custom password policies in ASP.NET

If you’re looking for a decent password strength control implementation for ASP.NET C# you could find this class I made a while ago useful enough. After all these years I’m still using it in a number of projects, from the good-old ASP.NET ASPX Forms to the new ASP.NET Core MVC applications.

The class can be used to perform basically all the required checks in a very customizable way: minimum length, maximum length, digit/numbers, special characters and so on. It features a PasswordStrength enum (and a GetPasswordStrength method) which you can use to calculate the average strength of any given password: it can be handy for general-purpose scenarios, when you don’t have to implement a given password policy. In case you have to do that, you can use the helper methods instead and combine them to suit your needs as shown in the sample implementation provided within the IsStrongPassword method – which is the one I’m still using in most cases.

The methods are quite self-explanatory, so there isn’t much more to say: if you like the class, feel free to leave a feedback in the comment section below!

Read More

Strip out numeric or non-numeric characters in string with ASP.NET C#

If you’re working with ASP.NET C# and you’re looking for something that could strip out numeric or non-numeric characters from a string, you might find these helper methods useful enough.

I wrote these methods to give an additional answer to this StackOverflow question, mostly because the accepted one didn’t handle null values: the behaviour of each one of them is well-documented within the <summary>  text, hence there’s nothing to explain here.

If you like them, feel free to leave a comment!


Programmatically create a Zip Archive file and send it as ActionResult using native ASP.NET MVC C#

If you’re working with ASP.NET or ASP.NET Core and you need to create a zip file on-the-fly within your controller – for example to allow the user to download multiple files with a single request – you can easily do that using the ZipArchive class, introduced in Framework 4.5.

Here’s a quick code sample using a MemoryStream and a couple of byte arrays representing two files:

Read More