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

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

One of the new features released in ASP.NET Core 1.1 is the ability to use middleware as an MVC Filter. In this post I'll take a look at how the feature is implemented by peering into the source code,...

View Article

Image may be NSFW.
Clik here to view.

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

In this post, I show how you can use the 'middleware as filters' feature of ASP.NET Core 1.1.0 to easily add request localisation based on url segments. The end goal we are aiming for is to easily...

View Article

Image may be NSFW.
Clik here to view.

Applying the RouteDataRequest CultureProvider globally with middleware as...

In my last post I showed how your could use the middleware as filters feature of ASP.NET Core 1.1.0 along with the RouteDataRequestCultureProvider to set the culture of your application from the url....

View Article


Image may be NSFW.
Clik here to view.

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

This is the next in a series of posts on using the middleware as filters feature of ASP.NET Core 1.1 to add a url culture provider to your application. To get an idea for how this works, take a look at...

View Article


Image may be NSFW.
Clik here to view.

Redirecting unknown cultures when using the url culture provider

This is the next in a series of posts on using the middleware as filters feature of ASP.NET Core 1.1 to add a url culture provider to your application. In this post I show how to handle the case where...

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 ASP.NET,...

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 a...

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.

Creating GitHub pull requests from the command-line with Hub

If you use GitHub much, you'll likely find yourself having to repeatedly use the web interface to raise pull requests. The web interface is great and all, but it can really take you out of your flow if...

View Article


Image may be NSFW.
Clik here to view.

Including linked files from outside the project directory in ASP.NET Core

This post is just a quick tip that I found myself using recently- including files in a project that are outside the project directory. I suspect this feature may have slipped under the radar for many...

View Article

Image may be NSFW.
Clik here to view.

ASP.NET Core in Action - MVC in ASP.NET Core

In February 2017, the Manning Early Access Program (MEAP) started for the ASP.NET Core book I am currently writing - ASP.NET Core in Action. This post is a sample of what you can find in the book. If...

View Article

Image may be NSFW.
Clik here to view.

Sharing appsettings.json configuration files between projects in ASP.NET Core

A pattern that's common for some apps is the need to share settings across multiple projects. For example, imagine you have both an ASP.NET Core RazorPages app and an ASP.NET Core Web API app in the...

View Article
Browsing all 743 articles
Browse latest View live