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

Image may be NSFW.
Clik here to view.

How to use multiple hosting environments on the same machine in ASP.NET Core

This short post is in response to a comment I received on a post I wrote a while ago, about how to set the hosting environment in ASP.NET Core. It's a question I've heard a couple of times, so thought...

View Article


Image may be NSFW.
Clik here to view.

The Microsoft.AspNetCore.All metapackage is huge, and that's awesome, thanks...

In the ASP.NET Core 2.0 preview 1 release, Microsoft have released a new metapackage called Microsoft.AspNetCore.All. This package consists of every single package shipped by Microsoft as part of...

View Article


Image may be NSFW.
Clik here to view.

Using ImageSharp to resize images in ASP.NET Core - Part 4: saving to disk

This is the next in a series of posts on using ImageSharp to resize images in an ASP.NET Core application. I showed how you could define an MVC action that takes a path to a file stored in the wwwroot...

View Article

Image may be NSFW.
Clik here to view.

Defining custom logging messages with LoggerMessage.Define in ASP.NET Core

One of the nice features introduced in ASP.NET Core is the universal logging infrastructure. In this post I take a look at one of the helper methods in the ASP.NET Core logging library, and how you...

View Article

Image may be NSFW.
Clik here to view.

Automatically validating anti-forgery tokens in ASP.NET Core with the...

This quick post is a response to a question about anti-forgery tokens I saw on twitter: I want to apply ValidateAntiForgeryToken to every action on all HttpPost requests in #AspNetCore MVC. Any easy...

View Article


Image may be NSFW.
Clik here to view.

Four ways to dispose IDisposables in ASP.NET Core

One of the most commonly implemented interfaces in .NET is the IDisposable interface. Classes implement IDisposable when they contain references to unmanaged resources, such as window handles, files...

View Article

Image may be NSFW.
Clik here to view.

Controller activation and dependency injection in ASP.NET Core MVC

In my last post about disposing IDsiposables in ASP.NET Core, Mark Rendle pointed out that MVC controllers are also disposed at the end of a request. On first glance, this may seem obvious given that...

View Article

Image may be NSFW.
Clik here to view.

When you use the Polly circuit-breaker, make sure you share your Policy...

This post is somewhat of PSA about using the excellent open source Polly library for handling resiliency to your application. Recently, I was tasked with adding a circuit-breaker implementation to...

View Article


Image may be NSFW.
Clik here to view.

Localising the DisplayAttribute in ASP.NET Core 1.1

This is a very quick post in response to a comment asking about the state of localisation for the DisplayAttribute in ASP.NET Core 1.1. A while ago I wrote a series of posts about localising your...

View Article


Image may be NSFW.
Clik here to view.

Creating custom password validators for ASP.NET Core Identity

ASP.NET Core Identity is a membership system that lets you add user accounts to your ASP.NET Core applications. It provides the low-level services for creating users, verifying passwords and signing...

View Article

Image may be NSFW.
Clik here to view.

Creating a validator to check for common passwords in ASP.NET Core Identity

In my last post, I showed how you can create a custom validator for ASP.NET Core. In this post, I introduce a package that lets you validate that a password is not one of the most common passwords...

View Article

Image may be NSFW.
Clik here to view.

Building ASP.NET Core 2.0 preview 2 packages on AppVeyor

I was recently creating a new GitHub project and I wanted to target ASP.NET Core 2.0 preview 2. I like to use AppVeyor for the CI build and for publishing to MyGet/NuGet, as I can typically just copy...

View Article

Image may be NSFW.
Clik here to view.

Customising ASP.NET Core Identity EF Core naming conventions for PostgreSQL

ASP.NET Core Identity is an authentication and membership system that lets you easily add login functionality to your ASP.NET Core application. It is designed in a modular fashion, so you can use any...

View Article


Image may be NSFW.
Clik here to view.

How to format response data as XML or JSON, based on the request URL in...

I think it's safe to say that most ASP.NET Core applications that use a Web API return data as JSON. What with JavaScript in the browser, and JSON parsers everywhere you look, this makes perfect...

View Article

Image may be NSFW.
Clik here to view.

Introduction to the ApiExplorer in ASP.NET Core

One of the standard services added when you call AddMvc() or AddMvcCore() in an ASP.NET Core MVC application is the ApiExplorer. In this post I'll show a quick example of its capabilities, and give...

View Article


Image may be NSFW.
Clik here to view.

The SDK 'Microsoft.Net.Sdk.Web' specified could not be found

This article describes why you get the error "The SDK 'Microsoft.Net.Sdk.Web' specified could not be found" when creating a new project in Visual Studio 2017 15.3, which prevents the project from...

View Article

Image may be NSFW.
Clik here to view.

Using CancellationTokens in ASP.NET Core MVC controllers

In this post I'll show how you can use a CancellationToken in your ASP.NET Core action method to stop execution when a user cancels a request from their browser. This can be useful if you have long...

View Article


Image may be NSFW.
Clik here to view.

Aligning strings within string.Format and interpolated strings

I was browsing through the MSDN docs the other day, trying to remind myself of the various standard ToString() format strings, when I spotted something I have somehow missed in all my years of .NET -...

View Article

Image may be NSFW.
Clik here to view.

Creating a rolling file logging provider for ASP.NET Core 2.0

ASP.NET Core includes a logging abstraction that makes writing logs to multiple locations easy. All of the first-party libraries that make up ASP.NET Core and EF Core use this abstraction, and the...

View Article

Image may be NSFW.
Clik here to view.

How to include scopes when logging exceptions in ASP.NET Core

This post describes how to work around an issue I ran into when logging exceptions that occur inside a scope block in ASP.NET Core. I'll provide a brief background on logging in ASP.NET Core,...

View Article
Browsing all 743 articles
Browse latest View live