Using routing DataTokens in ASP.NET Core
ASP.NET Core uses routing to map incoming URLs to controllers and action methods, and also to generate URLs when you provide route parameters. One of the lesser known features of the routing...
View ArticleSupporting both LTS and Current releases for ASP.NET Core
Some time ago, I wrote a post on how to use custom middleware to set various security headers in an ASP.NET Core application. This formed the basis for a small package on GitHub and NuGet that does...
View ArticleWhat is the Microsoft.AspNetCore metapackage?
One of the packages added to many ASP.NET Core templates is Microsoft.AspNetCore. This post takes a quick look at that package and what it contains. The Microsoft.AspNetCore package is often included...
View ArticleWhat is the NETStandard.Library metapackage?
In my last post, I took a quick look at the Microsoft.AspNetCore meta package. One of the libraries referenced by the package, is the NETStandard.Library NuGet package. In this post I take a quick...
View ArticleGit integration improvements in Visual Studio 2017 - git-hooks
Visual Studio 2017 includes a whole host of improvements to its Git integration. Among other things, SSH support is built it, you can push --force-with-lease, and easily diff commits. Some of these...
View ArticlePreventing mass assignment or over posting in ASP.NET Core
Mass assignment, also known as over-posting, is an attack used on websites that involve some sort of model-binding to a request. It is used to set values on the server that a developer did not expect...
View ArticleDeconstructors for non-tuple types in C# 7.0
As well as finally seeing the RTM of the .NET Core tooling, Visual Studio 2017 brought a whole host of new things to the table. Among these is C# 7.0, which introduces a number of new features to the...
View ArticleRe-execute the middleware pipeline with the StatusCodePages Middleware to...
By default, the ASP.NET Core templates include either the ExceptionHandlerMiddleware or the DeveloperExceptionPage. Both of these catch exceptions thrown by the middleware pipeline, but they don't...
View ArticleRetrieving the path that generated an error with the StatusCodePages Middleware
In my previous post, I showed how to use the re-execute features of the StatusCodePagesMiddleware to generate custom error pages for status-code errors. This allows you to easily create custom error...
View ArticleAdding favicons to your ASP.NET Core website with Real Favicon Generator
In this post I will show how you can add favicons to your ASP.NET Core MVC application, using the site realfavicongenerator.net. The days of being able to add a simple favicon.ico to the root of your...
View ArticleGetting started with 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 gives you a sample of what you can find in the...
View ArticleCreating and editing solution files with the .NET CLI
With the release of Visual Studio 2017 and the RTM .NET Core tooling, the .NET command line has gone through a transformation. The project.json format is no more, and instead we have returned back to...
View ArticleRemoving the MVC Razor dependencies from the Web API template in ASP.NET Core
In this article I'll show how to add the minimal required dependencies to create an ASP.NET Core Web API project, without including the additional MVC/Razor functionality and packages. Note: I have...
View ArticleCreating a basic Web API template using dotnet new custom templates
In my last post, I showed a simple, stripped-down version of the Web API template with the Razor dependencies removed. As an excuse to play with the new CLI templating functionality, I decided to turn...
View ArticleUsing ImageSharp to resize images in ASP.NET Core - a comparison with...
Currently, one of the significant missing features in .NET Core and .NET Standard are the System.Drawing APIs that you can use, among other things, for server-side image processing in ASP.NET Core....
View ArticleUsing ImageSharp to resize images in ASP.NET Core - Part 2
In my last post, I showed a way to crop and resize an image downloaded from a URL, using the ImageSharp library. This was in response to a post in which Dmitry Sikorsky used the...
View ArticleUsing ImageSharp to resize images in ASP.NET Core - Part 3: caching
In my previous post I updated my comparison between ImageSharp and CoreCompat.System.Drawing. Instead of loading an arbitrary file from a URL using the HttpClient, the path to a file in the wwwroot...
View ArticleThe .NET Core 2.0 Preview 1, version numbers and global.json
So as I'm sure most people reading this are aware, Microsoft announced ASP.NET Core and .NET Core 2.0 Preview 1 at Microsoft Build 2017 this week. I've been pretty busy with a variety of things, so I...
View ArticleExploring Program.cs, Startup.cs and CreateDefaultBuilder in ASP.NET Core 2...
One of the goals in ASP.NET Core 2.0 has been to clean up the basic templates, simplify the basic use-cases, and make it easier to get started with new projects. This is evident in the new Program and...
View ArticleUsing Razor Pages to simplify basic actions in ASP.NET Core 2.0 preview 1
One of the brand new features added to ASP.NET Core in version 2.0 preview 1 is Razor Pages. This harks back to the (terribly named) ASP.NET Web Pages framework, which was a simpler, page-based,...
View Article