Welcome to imar.spaanjaars.com

image
Welcome to the personal web site of Imar Spaanjaars where I write about software development with a focus on Microsoft web technologies
Image representing the Articles category

Using Standard Health Checks and Building your Own in ASP.NET Core

Published 6 days ago

Being able to monitor your ASP.NET Core web applications and APIs and detect any issues early on is crucial in ensuring your sites are up and running and in a healthy state. In previous articles I talked about creating a custom health check solution for ASP.NET Framework applications and implementing ASP.NET Core health checks with standard functionality. In this article I'll show you how to add and configure some existing, open-source health checks to monitor an SMTP server and the web server's disk space (these are just examples; there are many more health checks available that you can plug in to your own web site). And if the standard health checks aren't sufficient, you can build your own; something you'll see how to do in the second part of this article.

Read on ...
Image representing the Snippets category

Unit Testing Authorization on your Controllers

Published 8 days ago

In many of my ASP.NET web applications (mostly MVC or Web APIs) I have a mix of content with endpoints that either require authentication and authorization or that can be accessed anonymously. For example I have mostly public content (such as my own web site) with a protected management (admin) section. Or I have a Web API project with many endpoints protected by authorization but with a few of them publicly available. To ensure you protect your controllers well, you have many different options. In this article I'll show you a short unit test that you can use to ensure your controllers are properly configured when using a mixed authorization scenario.

Read on ...
Image representing the Articles category

Improving IntelliSense for the asp-page Tag Helper using T4 Templates

Published 12 days ago

I find ASP.NET Tag Helpers super helpful. They provide powerful features and yet use clean markup. As an example, here's a tag helper that creates a link to an action method in some controller:

<a asp-controller="Contact" asp-action="Index">Get in Touch</a>

At run-time, ASP.NET then generates the correct URL for this action method and creates an href attribute on the anchor for it:

<a href="/contact">Get in Touch</a>

Read on ...
Image representing the Articles category

Implementing Health Checks in ASP.NET Core

Published 15 days ago

Being able to monitor your ASP.NET Core web applications and APIs and detect any issues early on is crucial in ensuring your sites are up and running and in a healthy state. In a previous article I talked about creating a custom health check solution for ASP.NET Framework applications. In this article I'll show you how to leverage the built-in Health Check framework along with some third-party open-source add-ons available for ASP.NET Core applications. You may want to check out the previous article to better understand health checks and why they are useful. And seeing the custom solution for the .NET Framework may have you appreciate the built-in ASP.NET Core functionality even more. And in this article I'll dive a little deeper into some existing third-party health checks that make monitoring your sites and services super easy and show you how to build your own health checks and plug them into the system.

Read on ...
Image representing the Articles category

Implementing Health Checks in ASP.NET Framework Applications

Published 21 days ago

Being able to monitor your ASP.NET web applications and APIs and detect any issues early on is crucial in ensuring your sites are up and running and in a healthy state. With ASP.NET Core 2.2 and later this now comes in the box (as I'll show you in later articles) but for .NET Framework apps you'll have to use to kind of custom solution. To implement simple monitoring in ASP.NET Framework apps (i.e. non-Core applications), I usually add some custom code to my projects to provide health information from an endpoint and then use external tools to monitor that endpoint. In this article I'll show you how you can implement health checks using custom code targeting the .NET Framework (although it should also work on .NET Core). In future articles I'll then show you how you can set up similar checks in an ASP.NET Core app with standard functionality and how to extend the base system using existing third-party health checks like an SMTP server monitor, to make your health checks even more powerful.

Read on ...
Image representing the Blogs category

I'm back!

Published 21 days ago

I can't believe it's been almost 7 years since I last posted something here! Wow, time flies. Here's what happened.

Read on ...
Image representing the Articles category

Prefixing ID columns with the table name in Entity Framework

Published 6 years ago

I recently got a question about the database configuration part of my article series on N-Layer design in ASP.NET. In my model, all classes inherit DomainEntity<T> that defines a primary key called Id. This in turn means all primary key columns in the database are called Id as well. The reader wanted to know if it was possible to prefix that column with the entity / table name. So, the Id column in the People table would be called PersonId, the Id in EmailAddress would be called EmailAddressId and so on. This has always been possible (and easy to do) for separate entities, but EF 6's custom conventions makes it a lot easier to do it for the entire model.

Read on ...
Image representing the Articles category

ASP.NET N-Layered Applications - Extensions, Tools and Wrapping Up (Part 10)

Published 6 years ago

Note: this is part ten in a series of ten. If you rather read this entire series off-line, you can buy the full series as a convenient PDF document that comes with the full source. Besides the convenience, buying the PDF will also make you feel good as it shows your appreciation for the articles and helps me pay the bills for my server and hosting so I can keep running imar.spaanjaars.com and continue to provide you with great content. For more details, check out this post that shows you how you can buy the entire series right now.

This is Part 10 in a series of 10 that show you how to build N-Layered applications using ASP.NET 4.5 and Entity Framework 5 Code First. In this part I’ll discuss a few miscellaneous topics that I haven’t touched in previous articles in the series.

Read on ...
Image representing the Articles category

ASP.NET N-Layered Applications - Importing Data Using the API (Part 9)

Published 6 years ago

Note: this is part nine in a series of ten. If you rather read this entire series off-line, you can buy the full series as a convenient PDF document that comes with the full source. Besides the convenience, buying the PDF will also make you feel good as it shows your appreciation for the articles and helps me pay the bills for my server and hosting so I can keep running imar.spaanjaars.com and continue to provide you with great content. For more details, check out this post that shows you how you can buy the entire series right now.

This is Part 9 in a series of 10 that show you how to build N-Layered applications using ASP.NET 4.5 and Entity Framework 5 Code First. In this part you’ll see how to build a command line application to import data from an external source (a CSV file in this case), using the application’s repository and model classes. Although this article is not related to ASP.NET directly, many ASP.NET developers may still benefit from it as importing data from an external resource is a common activity for ASP.NET developers.

Read on ...
Image representing the Articles category

ASP.NET N-Layered Applications - Implementing a WCF 4.5 Frontend (Part 8)

Published 7 years ago

Note: this is part eight in a series of ten. If you rather read this entire series off-line, you can buy the full series as a convenient PDF document that comes with the full source. Besides the convenience, buying the PDF will also make you feel good as it shows your appreciation for the articles and helps me pay the bills for my server and hosting so I can keep running imar.spaanjaars.com and continue to provide you with great content. For more details, check out this post that shows you how you can buy the entire series right now.

This is Part 8 in a series of 10 that show you how to build N-Layered applications using ASP.NET 4.5 and Entity Framework 5 Code First. In this part you’ll see how to build a WCF service that makes use of the model and repository projects I have shown in the first five articles in this series. The WCF service can be used by different types of applications to access contact people and their related data.

Read on ...

Mobile: False

Crawler: True

I: False