Quantcast
Channel: Andrew Lock | .NET Escapades
Browsing all 743 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

5 ways to set the URLs for an ASP.NET Core app

By default, ASP.NET Core apps listen on the following URLs: http://localhost:5000 https://localhost:5001 In this post I show 5 different ways to change which URLs your app listens on. There are...

View Article


Image may be NSFW.
Clik here to view.

How to automatically choose a free port in ASP.NET Core 3.0

This post is in response to a discussion I had with a friend recently who was trying out .NET Core. Unfortunately, when they attempted to start their new application they received the following...

View Article


Image may be NSFW.
Clik here to view.

Adding simple email address obfuscation for your blog like Cloudflare Scrape...

In this post I show a simple way to obfuscate email addresses to make it harder for bots to scrape them from your site. It uses a similar approach as Cloudflare Scrape Shield. It's important to not...

View Article

Image may be NSFW.
Clik here to view.

Preventing mass assignment or over posting with Razor Pages in ASP.NET Core

Mass assignment, also known as over-posting, is an attack used on websites that use model-binding. It is used to set values on the server that a developer did not expect to be set. This is a well known...

View Article

Image may be NSFW.
Clik here to view.

Using jQuery and Bootstrap from a CDN with fallback scripts in ASP.NET Core 3.0

In this post, I show how to use the Link Tag Helper and Script Tag Helper in Razor with the asp-fallback attribute to serve files from a Content Delivery Network (CDN), falling back to local scripts if...

View Article


Image may be NSFW.
Clik here to view.

Extending the shutdown timeout setting to ensure graceful IHostedService...

I was seeing an issue recently where our application wasn't running the StopAsync method in our IHostedService implementations when the app was shutting down. It turns out that this was due to some...

View Article

Image may be NSFW.
Clik here to view.

Handling Web API Exceptions with ProblemDetails middleware

In this short post I describe a handy error-handling middleware, created by Kristian Hellang, that is used to return ProblemDetails results when an exception occurs. ProblemDetails and the...

View Article

Image may be NSFW.
Clik here to view.

Strongly-typed ID update 0.2.1: Using strongly-typed entity IDs to avoid...

Last year I wrote a series about using strongly typed IDs to avoid a whole class of bugs in C# applications. In this post I describe some recent updates to a NuGet package that drastically reduces the...

View Article


Image may be NSFW.
Clik here to view.

Customising the ASP.NET Core default UI without editing the PageModels

ASP.NET Core Identity includes a default UI as a Razor library that enables you to quickly add users to an application, without having to build all the UI yourself. The downside is that if you want to...

View Article


Image may be NSFW.
Clik here to view.

Setting global authorization policies using the DefaultPolicy and the...

ASP.NET Core has an extensive authorization system that you can use to create complex authorization policies. In this post, I look at the various ways you can apply these policies to large sections of...

View Article

Image may be NSFW.
Clik here to view.

Adding host filtering to Kestrel in ASP.NET Core

Host filtering, restricting the hostnames that your app responds to, is recommended whenever you're running in production for security reasons. In this post, I describe how to add host filtering to an...

View Article

Image may be NSFW.
Clik here to view.

Getting started with ASP.NET Core

The Manning Early Access Program (MEAP) has started for the second edition of my book ASP.NET Core in Action, Second Edition. This post gives you a sample of what you can find in the book. If you like...

View Article

Image may be NSFW.
Clik here to view.

Visualizing ASP.NET Core endpoints using GraphvizOnline and the DOT language

In this post I show how the endpoint routes in an ASP.NET Core 3.0 application can be visualized using the GraphvizOnline service. That lets you create diagrams like the following, which describe all...

View Article


Image may be NSFW.
Clik here to view.

Adding an endpoint graph to your ASP.NET Core application: Visualizing...

In this post I show how to visualize the endpoint routes in your ASP.NET Core 3.0 application using the DfaGraphWriter service. I show how to generate a directed graph (as shown in my previous post)...

View Article

Image may be NSFW.
Clik here to view.

Creating a custom DfaGraphWriter using ImpromptuInterface for easier...

In this post I lay the groundwork for creating a custom implementation of DfaGraphWriter. DfaGraphWriter is public, so you can use it in your application as I showed in my previous post, but all the...

View Article


Image may be NSFW.
Clik here to view.

Creating a custom DfaGraphWriter using ImpromptuInterface for easier...

In this post I lay the groundwork for creating a custom implementation of DfaGraphWriter. DfaGraphWriter is public, so you can use it in your application as I showed in my previous post, but all the...

View Article

Image may be NSFW.
Clik here to view.

Creating a custom endpoint visualization graph: Visualizing ASP.NET Core 3.0...

In this series, I've been laying the groundwork for building a custom endpoint visualization graph, as I showed in my first post. This graph shows the different parts of the endpoint routes: literal...

View Article


Image may be NSFW.
Clik here to view.

Detecting duplicate routes in ASP.NET Core: Visualizing ASP.NET Core 3.0...

In this series, I have shown how to view all the routes in your application using an endpoint graph. In this post I show how to do something more useful—detecting duplicate routes that would throw an...

View Article

Image may be NSFW.
Clik here to view.

Exploring the code behind IHttpClientFactory in depth

In this post I take a look at the code in the default implementation of IHttpClientFactory in ASP.NET Core—DefaultHttpClientFactory. We'll see how it ensures that HttpClient instances created with the...

View Article

Image may be NSFW.
Clik here to view.

DI scopes in IHttpClientFactory message handlers don't work like you think...

In this post I discuss how dependency injection scopes work in the context of IHttpClientFactory. The title of this post reflects the fact that they don't work like I previously expected them to! This...

View Article
Browsing all 743 articles
Browse latest View live