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

Merge multiple GIF, PNG, JPG, TIFF and PDF files into a single PDF file with ASP.NET C# using the iTextSharp library

Yesterday I released a small project I was working on to merge multiple image files into a single, multi-page PDF (one image per page). It wasn’t too difficult, yet I had to deal with the following issues:

  • Some nasty GDI+ issues when dealing with multi-page TIFF files (read this post for further details on that).
  • Some nasty GDI+ issues when trying to resize/resample each image to make it fit to the container PDF page size.

Yeah, you can easily guess I really don’t like GDI+. Luckily enough, I found a great open-source alternative to deal with these issues: I’m talking about the iTextSharp library, freely available through NuGet or SourceForge, which can flawlessly do these kind of tasks.

Using it proved to be really simple; here’s what I did to fullfill my specific scenario (WARNING! big amount of source code incoming):

Read More

ASP.NET – CSS Media Queries in Razor Pages – How to embed @media syntax

If you’re working with ASP.NET MVC or ASP.NET Core using Razor pages and you want to put a CSS style within the page (CSS embed), you might stumble upon one of these following errors:

CS0103: The name ‘media’ does not exist in the current context.

CS0103: The name ‘if’ does not exist in the current context.

… And so on.

When something like that occurs, it probably means that you’re using a CSS3 media query (or other CSS3 query related commands) such as this:

Read More

ASP.NET C# Helper Class to execute a ICMPv4 PING to any remote host using hostname or IP Address

Today I want to share this small, yet useful C# helper class that I still use when I need to retrieve, check or validate one or more IP Addresses registered on the Web Server. You can use it for a number of tasks/scenarios, including:

  • Retrieve the first available IP Address of the Web Server machine hosting the Web Application.
  • Retrieve a list of all the IPV4 and IPV6 Addresses registered on the Web Server machine hosting the Web Application.
  • Check if a given IP Address is one of the IP Addresses registered on the Web Server.

The helper class was made some years ago, yet it can still be used on any ASP.NET project, including ASP.NET Forms, ASPX pages, ASP.NET MVC, ASP.NET Web API, ASP.NET WCF with any other framework versions & builds, up to the most recent ASP.NET Core.

Here it is: enjoy!

In case you also need to retrieve IP Address(es) of the Web Server machine hosting the Web Application and/or check if a given IP Address is registered on the Web Server or not, you can integrate within this class the GetIPAddress, GetIPAddresses and HasIPAddress methods described in this other post.

 

Close