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

Image may be NSFW.
Clik here to view.

Resource-based authorisation in ASP.NET Core

In this next post on authorisation in ASP.NET Core, we look at how you can secure resources based on properties of that resource itself. In a previous post, we saw how you could create a policy that...

View Article


Image may be NSFW.
Clik here to view.

Accessing services when configuring MvcOptions in ASP.NET Core

This post is a follow on to an article by Steve Gordon I read the other day on how to HTML encode deserialized JSON content from a request body. It's an interesting post, but it spurred me thinking...

View Article


Image may be NSFW.
Clik here to view.

Adding Cache-Control headers to Static Files in ASP.NET Core

Thanks to the ASP.NET Core middleware pipeline, it is relatively simple to add additional HTTP headers to your application by using custom middleware. One common use case for this is to add caching...

View Article

Image may be NSFW.
Clik here to view.

Using dependency injection in a .Net Core console application

One of the key features of ASP.NET Core is baked in dependency injection. There may be various disagreements on the way that is implemented, but in general encouraging a good practice by default seems...

View Article

Image may be NSFW.
Clik here to view.

Fixing a bug: when concatenated strings turn into numbers in JavaScript

This is a very quick post about trying to fix a JavaScript bug that plagued me for an hour this morning. tl;dr I was tripped up by a rogue unary operator and slap-dash copy-pasting. The setup On an...

View Article


Image may be NSFW.
Clik here to view.

Making ConcurrentDictionary GetOrAdd thread safe using Lazy

I was browsing the ASP.NET Core MVC GitHub repo the other day, checking out the new 1.1.0 Preview 1 code, when I spotted a usage of ConcurrentDictionary that I thought was interesting. This post...

View Article

Image may be NSFW.
Clik here to view.

Troubleshooting ASP.NET Core 1.1.0 install problems

I was planning on playing with the latest .NET Core 1.1.0 preview recently, but I ran into a few issues getting it working on my Mac. As I suspected, this was entirely down to my mistakes and my...

View Article

Image may be NSFW.
Clik here to view.

Exploring Middleware as MVC Filters in ASP.NET Core 1.1: Adding a URL culture...

This is the first post in the series: Adding a URL culture provider using middleware as filters. Part 1 - Exploring Middleware as MVC Filters in ASP.NET Core 1.1 (this post) Part 2 - Url culture...

View Article


Image may be NSFW.
Clik here to view.

Url culture provider using middleware as filters in ASP.NET Core 1.1.0:...

This is the second post in the series: Adding a URL culture provider using middleware as filters. Part 1 - Exploring Middleware as MVC Filters in ASP.NET Core 1.1 Part 2 - Url culture provider using...

View Article


Image may be NSFW.
Clik here to view.

Applying the RouteDataRequest CultureProvider globally with middleware as...

This is the third post in the series: Adding a URL culture provider using middleware as filters. Part 1 - Exploring Middleware as MVC Filters in ASP.NET Core 1.1 Part 2 - Url culture provider using...

View Article

Image may be NSFW.
Clik here to view.

Using a culture constraint and redirecting 404s with the url culture...

This is the fourth post in the series: Adding a URL culture provider using middleware as filters. Part 1 - Exploring Middleware as MVC Filters in ASP.NET Core 1.1 Part 2 - Url culture provider using...

View Article

Image may be NSFW.
Clik here to view.

Redirecting unknown cultures when using the url culture provider: Adding a...

This is the fifth post in the series: Adding a URL culture provider using middleware as filters. Part 1 - Exploring Middleware as MVC Filters in ASP.NET Core 1.1 Part 2 - Url culture provider using...

View Article

Image may be NSFW.
Clik here to view.

Understanding and updating package versions for .NET Core 1.0.3

Microsoft introduced the second update to their Long Term Support (LTS) version of .NET Core on 13th December, 3 months after releasing the first update to the platform. This included updates to .NET...

View Article


Image may be NSFW.
Clik here to view.

An introduction to ViewComponents - a login status view component

View components are one of the potentially less well known features of ASP.NET Core Razor views. Unlike tag-helpers which have the pretty much direct equivalent of Html Helpers in the previous...

View Article

Image may be NSFW.
Clik here to view.

How to pass parameters to a view component

In my last post I showed how to create a custom view component to simplify my Razor views, and separate the logic of what to display from the UI concern. View components are a good fit where you have...

View Article


Image may be NSFW.
Clik here to view.

Reloading strongly typed options in ASP.NET Core 1.1.0

Back in June, when ASP.NET Core was still in RC2, I wrote a post about reloading strongly typed Options when the underlying configuration sources (e.g. a JSON) file changes. As I noted in that post,...

View Article

Image may be NSFW.
Clik here to view.

Logging using DiagnosticSource in ASP.NET Core

Logging in the ASP.NET Core framework is implemented as an extensible set of providers that allows you to easily plug in new providers without having to change your logging code itself. The docs give...

View Article


Image may be NSFW.
Clik here to view.

Exploring IStartupFilter in ASP.NET Core

Note The MEAP preview of my book, ASP.NET Core in Action is now available from Manning! Use the discount code mllock to get 50% off, valid through February 13. I was spelunking through the ASP.NET...

View Article

Image may be NSFW.
Clik here to view.

Understanding your middleware pipeline with the Middleware Analysis package

Edited 18th Feb 17, to add section on adding a custom name for anonymous middleware In a recent post I took a look at the IStartupFilter interface, a little known feature that can be used to add...

View Article

Image may be NSFW.
Clik here to view.

Under the hood of the Middleware Analysis package

In my last post I showed how you could use the Microsoft.AspNetCore.MiddlewareAnalysis package to analyse your middleware pipeline. In this post I take a look at the source code behind the package, to...

View Article
Browsing all 743 articles
Browse latest View live