Building a lightweight, controller-less, Markdown-only website in ASP.NET Core

In this blog post let’s have a look at building a lightweight site in ASP.NET Core.

In “classic” ASP.NET we had the WebPages framework – which allowed us to build sites composed only of views. This was perfect for lightweight projects, where we didn’t need the entire model-controller infrastructure.

At the moment, ASP.NET Core doesn’t have an equivalent yet (though it’s being worked on), but we have already provided a similar type of experience via the WebApiContrib project (you can read more about the project here). With the help of some of the libraries from there, we can build controller-less sites for ASP.NET Core already.

In addition to that, we can combine it with using Markdown tag helpers for content delivery – and it will result in a very cool experience – being able to author ASP.NET Core sites, without controllers, in Markdown. With Razor sprinkled on top of it, to provide dynamic data.

Let’s have a look – more after the jump.

Continue Reading


Announcing WebApiContrib for ASP.NET Core

In the past, a bunch of us from the ASP.NET Web API community worked together on a WebApiContrib project (or really, projects, cause there were many of them!).

The idea was to provide an easy to use platform, a one stop place for community contributions for ASP.NET Web API – both larger add ons, such as HTML/Razor support for Web API, as well as smaller things like i.e. reusable filters or even helper methods. This worked extremely well – WebApiContrib packages were downloaded over 500k times on Nuget, and a nice community has emerged around the project on Github.

Recently, we decided to restart the project, this time focusing on ASP.NET Core. Since the “brand” has caught on in the community and is fairly recognizable, we just called it WebApiContrib.Core.

Continue Reading


Customizing FormatFilter behavior in ASP.NET Core MVC 1.0

When you are building HTTP APIs with ASP.NET Core MVC, the framework allows you to use FormatFilter to let the calling client override any content negotiation that might have happened on the server side.

This way, the client can – for example – force the return data to be JSON or CSV or any other format suitable (as long as the server supports it, of course) for his consumption.

The built-in mechanism (out of the box version of FormatFilter) is a little limited, so let’s have a look at how you can extend and customize its behavior.

Continue Reading




Global route prefix in ASP.NET Core MVC (revisited)

A couple of months ago I blogged about adding a feature to ASP.NET Core MVC (or ASP.NET 5 at the time) that will allow you to set central route prefix(es) to your attribute routing mechanism.

That solution was written against beta8 version of ASP.NET Core and since now we are at RC2 – it doesn’t (surprise, surprise) work anymore.

Here is the updated version.

Continue Reading


Introducing Strathweb TypedRouting for ASP.NET MVC Core

One of the side projects I created for Web API a while ago was Strathweb.TypeRouting – a little library built on top of the attribute routing extensibility points, that allowed you to declare Web API routes centrally, in a strongly typed way (as opposed to the built in, anonymous object approach).

Then, some time ago, I blogged about how you would achieve the same thing in ASP.NET Core. A bunch of things have changed since then – the original post was written against beta6 of the framework I believe.

Last week, I set up the code on Github, migrated everything to RC2 and released on NuGet for everyone to use.

Continue Reading


Running multiple ASP.NET Web API pipelines side by side

Over the past 4 years or so, I have worked on many Web API projects, for a lot of different clients, and I thought I have seen almost everything.

Last week I came across an interesting new (well, at least to me) scenario though – with the requirement to run two Web API pipelines side by side, in the same process. Imagine having /api as one Web API “instance”, and then having /dashboard as completely separate one, with it’s own completely custom configuration (such as formatter settings, authentication or exception handling). And all of that running in the same process.

More after the jump.

Continue Reading


NDC Oslo Web API sample updated to ASP.NET Core RC2

Last year at NDC Oslo I did a talk about migrating from ASP.NET Web API to ASP.NET 5 MVC 6 (as it was called at the time).

The talk was done against the beta 6 version of the runtime, so release-wise, it was quite a way back.

To celebrate today’s release of ASP.NET Core RC2, I have updated the code samples from the talk to that RC2 version. Hopefully folks would still find it useful.

Continue Reading


IP Filtering in ASP.NET Web API

One of the functionalities I had to use fairly often on different ASP.NET Web API projects that I was involved in in the past was IP filtering – restricting access to the whole API, or to parts of it, based on the caller’s IP address.

I thought it might be useful to share this here. More after the jump.

Continue Reading


Pages:123...16»