<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Asp.net Mvc on Strathweb. A free flowing tech monologue.</title>
    <link>https://www.strathweb.com/categories/asp.net-mvc/</link>
    <description>Recent content in Asp.net Mvc on Strathweb. A free flowing tech monologue.</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 30 Jul 2018 16:22:13 +0000</lastBuildDate><atom:link href="https://www.strathweb.com/categories/asp.net-mvc/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Centralized exception handling and request validation in ASP.NET Core</title>
      <link>https://www.strathweb.com/2018/07/centralized-exception-handling-and-request-validation-in-asp-net-core/</link>
      <pubDate>Mon, 30 Jul 2018 16:22:13 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2018/07/centralized-exception-handling-and-request-validation-in-asp-net-core/</guid>
      <description>&lt;p&gt;One of the most common things that I have seen developers working with ASP.NET Core struggle with, is the way to centrally and consistently handle application errors and input validation. Those seemingly different topics are really two sides of the same coin.&lt;/p&gt;
&lt;p&gt;More often than not, exceptions are just allowed to bubble all the way up and left unhandled, leaving the framework the responsibility to convert them to a generic 500 errors. In many other situations, exception handling is fragmented and happens in certain individual controllers only. With regard to input validation, we often have completely customized ways of notifying the client about input issues or - at best - we leave everything to the framework and let it work its defaults via the &lt;em&gt;ModelState&lt;/em&gt; functionality.&lt;/p&gt;
&lt;p&gt;What I wanted to show you today is how you can introduce a consistent, centralized way of handling exceptions and request validation in an ASP.NET Core web application.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>[Required] and [BindRequired] in ASP.NET Core MVC</title>
      <link>https://www.strathweb.com/2017/12/required-and-bindrequired-in-asp-net-core-mvc/</link>
      <pubDate>Thu, 21 Dec 2017 14:30:21 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2017/12/required-and-bindrequired-in-asp-net-core-mvc/</guid>
      <description>&lt;p&gt;When controlling the binding behavior of models in ASP.NET Core MVC applications, it is very common to perform some validation on them. For that, &lt;a href=&#34;https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations%28v=vs.110%29.aspx?f=255&amp;amp;MSPPError=-2147217396&#34;&gt;data annotations&lt;/a&gt; are a perfect tool.&lt;/p&gt;
&lt;p&gt;One of the most typical use cases of data annotations is to ensure that a value of a certain property has been provided by the caller of the API - and this, historically (in &amp;ldquo;classic&amp;rdquo; ASP.NET MVC), has been controlled by &lt;em&gt;RequiredAttribute&lt;/em&gt;. The attribute can still be used in ASP.NET Core MVC, but there is also a new one - &lt;em&gt;BindRequiredAttribute&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s have a look at the subtle differences between them.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Customizing query string parameter binding in ASP.NET Core MVC</title>
      <link>https://www.strathweb.com/2017/07/customizing-query-string-parameter-binding-in-asp-net-core-mvc/</link>
      <pubDate>Fri, 21 Jul 2017 13:55:42 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2017/07/customizing-query-string-parameter-binding-in-asp-net-core-mvc/</guid>
      <description>&lt;p&gt;A few years ago I blogged about &lt;a href=&#34;https://www.strathweb.com/2013/04/asp-net-web-api-parameter-binding-part-1-understanding-binding-from-uri/&#34;&gt;binding parameters from URI&lt;/a&gt; in ASP.NET Web API. One of the examples in that post was how to bind a comma-separated collection passed to your API as a query string parameter.&lt;/p&gt;
&lt;p&gt;Technologies change, and we now work with ASP.NET Core (and the MVC Core framework), but problems remain the same - so let&amp;rsquo;s have a look at how we can customize the way parameters are bound from query string in ASP.NET Core MVC.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Using IActionConstraints in ASP.NET Core MVC</title>
      <link>https://www.strathweb.com/2017/06/using-iactionconstraints-in-asp-net-core-mvc/</link>
      <pubDate>Tue, 20 Jun 2017 14:02:03 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2017/06/using-iactionconstraints-in-asp-net-core-mvc/</guid>
      <description>&lt;p&gt;ASP.NET Core provides a way to constraint parameter values when matching routes via an &lt;em&gt;IRouteConstraint&lt;/em&gt; (&lt;a href=&#34;https://docs.microsoft.com/en-us/aspnet/core/fundamentals/routing#route-constraint-reference&#34;&gt;read more here&lt;/a&gt;) interface. This can be very useful, if you want to disambiguate certain routes from one another. This functionality is built into the routing package and is independent from the MVC framework.&lt;/p&gt;
&lt;p&gt;However, aside from that, the MVC framework itself also provides an interesting constraint-mechanism - &lt;em&gt;IActionConstraints&lt;/em&gt;. Let&amp;rsquo;s have a look at them today.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Running multiple independent ASP.NET Core pipelines side by side in the same application</title>
      <link>https://www.strathweb.com/2017/04/running-multiple-independent-asp-net-core-pipelines-side-by-side-in-the-same-application/</link>
      <pubDate>Fri, 07 Apr 2017 09:17:39 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2017/04/running-multiple-independent-asp-net-core-pipelines-side-by-side-in-the-same-application/</guid>
      <description>&lt;p&gt;The other day I started looking into a problem of being able to run several independent ASP.NET Core pipelines from within the same main application, running on top of the same Kestrel server. This was actually &lt;a href=&#34;https://github.com/aspnet/Mvc/issues/5326&#34;&gt;asked on MVC Github repo&lt;/a&gt; but closed without a real answer.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s have a detailed look at the problem, and (one) possible solution to it.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Required query string parameters in ASP.NET Core MVC</title>
      <link>https://www.strathweb.com/2016/09/required-query-string-parameters-in-asp-net-core-mvc/</link>
      <pubDate>Mon, 19 Sep 2016 15:26:02 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2016/09/required-query-string-parameters-in-asp-net-core-mvc/</guid>
      <description>&lt;p&gt;Today let&amp;rsquo;s have a look at two extensibility points in ASP.NET Core MVC - &lt;em&gt;IActionConstraint&lt;/em&gt; and &lt;em&gt;IParameterModelConvention&lt;/em&gt;. We&amp;rsquo;ll see how we can utilize them to solve a problem, that is not handled out of the box by the framework - creating an MVC action that has mandatory query string parameters.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s have a look.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>[Controller] and [NonController] attributes in ASP.NET Core MVC</title>
      <link>https://www.strathweb.com/2016/09/controller-and-noncontroller-attributes-in-asp-net-core-mvc/</link>
      <pubDate>Thu, 08 Sep 2016 15:08:41 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2016/09/controller-and-noncontroller-attributes-in-asp-net-core-mvc/</guid>
      <description>&lt;p&gt;One of the late additions before the RTM release of ASP.NET Core MVC was the introduction of the &lt;em&gt;[Controller]&lt;/em&gt; attribute, and its counterpart, &lt;em&gt;[NonController]&lt;/em&gt;, which were added in RC2.&lt;/p&gt;
&lt;p&gt;Together, they allow you to more specifically control which classes should be considered by the framework to be controllers (or controller candidates) and which shouldn&amp;rsquo;t. They also help you avoid the nasty hacks we needed to do in i.e. &lt;a href=&#34;https://www.strathweb.com/2013/02/but-i-dont-want-to-call-web-api-controllers-controller/&#34;&gt;ASP.NET Web API&lt;/a&gt; to opt out from the &amp;ldquo;Controller&amp;rdquo; suffix in the name.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s have a look.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Customizing FormatFilter behavior in ASP.NET Core MVC 1.0</title>
      <link>https://www.strathweb.com/2016/07/customizing-formatfilter-behavior-in-asp-net-core-mvc-1-0/</link>
      <pubDate>Wed, 06 Jul 2016 18:57:33 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2016/07/customizing-formatfilter-behavior-in-asp-net-core-mvc-1-0/</guid>
      <description>&lt;p&gt;When you are building HTTP APIs with ASP.NET Core MVC, the framework allows you to use &lt;em&gt;FormatFilter&lt;/em&gt; to let the calling client override any content negotiation that might have happened on the server side.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;The built-in mechanism (out of the box version of &lt;em&gt;FormatFilter&lt;/em&gt;) is a little limited, so let&amp;rsquo;s have a look at how you can extend and customize its behavior.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Predefined Namespaces And Custom Base View Page in ASP.NET Core 1.0 MVC</title>
      <link>https://www.strathweb.com/2016/04/predefined-namespaces-and-custom-base-view-page-in-asp-net-core-1-0-mvc/</link>
      <pubDate>Fri, 08 Apr 2016 00:06:44 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2016/04/predefined-namespaces-and-custom-base-view-page-in-asp-net-core-1-0-mvc/</guid>
      <description>&lt;p&gt;It is quite common to predefine some namespaces to be available in the context of your Razor view files in ASP.NET MVC. In MVC 5, it was done inside the &lt;em&gt;web.config&lt;/em&gt; file - not the &amp;ldquo;main&amp;rdquo; application one, but the one residing inside your &lt;em&gt;Views&lt;/em&gt; folder.&lt;/p&gt;
&lt;p&gt;Additionally, the same file was used to define the &lt;em&gt;pageBaseType&lt;/em&gt; for your Razor views. This way you could expose extra members or behaviors to your pages, such as injected services or common configuration objects.&lt;/p&gt;
&lt;p&gt;Since there is no more &lt;em&gt;web.config&lt;/em&gt; in ASP.NET Core 1.0 MVC, let&amp;rsquo;s have a look at how to achieve the same in the next generation ASP.NET.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>ASP.NET MVC 6 formatters – XML and browser requests</title>
      <link>https://www.strathweb.com/2015/04/asp-net-mvc-6-formatters-xml-browser-requests/</link>
      <pubDate>Fri, 24 Apr 2015 11:32:15 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2015/04/asp-net-mvc-6-formatters-xml-browser-requests/</guid>
      <description>&lt;p&gt;A while ago I &lt;a href=&#34;https://www.strathweb.com/2014/11/formatters-asp-net-mvc-6/&#34;&gt;wrote a post&lt;/a&gt; about formatters in MVC 6.&lt;/p&gt;
&lt;p&gt;Since then, there have been some changes regarding XML handling and an interesting feature that was added recently that was not part of that post, so I think it warranties a follow up. XML formatter is now removed by default. On top of that, MVC 6 will attempt to sniff out whether your request is originating from a browser&amp;rsquo;s address bar and adjust content negotiation accordingly.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>How ASP.NET MVC 6 discovers controllers?</title>
      <link>https://www.strathweb.com/2015/04/asp-net-mvc-6-discovers-controllers/</link>
      <pubDate>Wed, 01 Apr 2015 09:58:29 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2015/04/asp-net-mvc-6-discovers-controllers/</guid>
      <description>&lt;p&gt;In the past I did a couple of blog posts (&lt;a href=&#34;https://www.strathweb.com/2013/08/customizing-controller-discovery-in-asp-net-web-api/&#34;&gt;here&lt;/a&gt; and &lt;a href=&#34;https://www.strathweb.com/2012/06/using-controllers-from-an-external-assembly-in-asp-net-web-api/&#34;&gt;here&lt;/a&gt;) about how ASP.NET Web API discovers controllers.&lt;/p&gt;
&lt;p&gt;ASP.NET MVC 6 supports both regular controllers (inheriting from &lt;em&gt;Controller&lt;/em&gt; base type) and POCO controllers. Let&amp;rsquo;s have a look at how the discovery of them happens in ASP.NET MVC 6. Note that the code and mechanisms discussed in this article were introduced after ASP.NET 5 beta3 was released, so it is not yet available if you use the version of ASP.NET 5 bundled with Visual Studio 2015 CTP6.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Strongly typed routing for ASP.NET MVC 6 with IApplicationModelConvention</title>
      <link>https://www.strathweb.com/2015/03/strongly-typed-routing-asp-net-mvc-6-iapplicationmodelconvention/</link>
      <pubDate>Wed, 11 Mar 2015 18:28:27 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2015/03/strongly-typed-routing-asp-net-mvc-6-iapplicationmodelconvention/</guid>
      <description>&lt;p&gt;This is something I hacked together last night, but it was a very interesting exercise into customizing the new (or rather, future) ASP.NET MVC 6 to suit your needs.&lt;/p&gt;
&lt;p&gt;If you visit this blog from time to time, some time ago I &lt;a href=&#34;https://www.strathweb.com/2014/07/building-strongly-typed-route-provider-asp-net-web-api/&#34;&gt;blogged about building strongly typed routing provider for ASP.NET Web API&lt;/a&gt; (&lt;a href=&#34;https://github.com/filipw/Strathweb.TypedRouting&#34;&gt;code is here&lt;/a&gt;). That was built around extensibility points provided by the direct routing mechanism (better known as direct routing&amp;rsquo;s default implementation - attribute routing).&lt;/p&gt;
&lt;p&gt;So I thought, it would be fun to port this solution to MVC 6. However, while MVC 6 supports attribute routing, it does not provide the same abstractions over the routing mechanism. Instead it exposes something new for both MVC and Web API developers - &lt;em&gt;IApplicationModelConvention&lt;/em&gt;, which is what we&amp;rsquo;ll use here.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Overriding filters in ASP.NET MVC 6</title>
      <link>https://www.strathweb.com/2015/02/overriding-filters-asp-net-mvc-6/</link>
      <pubDate>Thu, 12 Feb 2015 11:05:48 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2015/02/overriding-filters-asp-net-mvc-6/</guid>
      <description>&lt;p&gt;There are many posts out there, including on this blog, about &lt;em&gt;what&amp;rsquo;s in&lt;/em&gt; ASP.NET MVC 6 and how to use it. This one however, will be about &lt;em&gt;what&amp;rsquo;s not in&lt;/em&gt; the framework, or at least not in the same way as you might be used to it from MVC 5/Web API 2 - the ability to override filters. I was recently working on an MVC 6 project and ran into this exact problem.&lt;/p&gt;
&lt;p&gt;In MVC 5 and Web API 2, there was a &lt;a href=&#34;https://www.strathweb.com/2013/06/overriding-filters-in-asp-net-web-api-vnext/&#34;&gt;built in way to do it&lt;/a&gt;, and even though it was not very extensible, it proved to be very handy (at least for me).&lt;/p&gt;
&lt;p&gt;IN MVC 6, these override filters are gone, so at first glance, filter overriding is quite difficult. In reality, that&amp;rsquo;s not the case, you just need to know what to do - let&amp;rsquo;s have a look.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Migrating from ASP.NET Web API to MVC 6 – exploring Web API Compatibility Shim</title>
      <link>https://www.strathweb.com/2015/01/migrating-asp-net-web-api-mvc-6-exploring-web-api-compatibility-shim/</link>
      <pubDate>Wed, 21 Jan 2015 12:59:52 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2015/01/migrating-asp-net-web-api-mvc-6-exploring-web-api-compatibility-shim/</guid>
      <description>&lt;p&gt;Migrating an MVC 5 project to ASP.NET 5 and MVC 6 is a big challenge given that both of the latter are complete rewrites of their predecessors. As a result, even if on the surface things seem similar (we have controllers, filters, actions etc), as you go deeper under the hood you realize that most, if not all, of your pipeline customizations will be incompatible with the new framework.&lt;/p&gt;
&lt;p&gt;This pain is even more amplified if you try to migrate Web API 2 project to MVC 6 - because Web API had a bunch of its own unique concepts and specialized classes, all of which only complicate the migration attempts.&lt;/p&gt;
&lt;p&gt;ASP.NET team provides an extra convention set on top of MVC 6, called &lt;a href=&#34;https://github.com/aspnet/Mvc/tree/dev/src/Microsoft.AspNet.Mvc.WebApiCompatShim&#34;&gt;&amp;ldquo;Web API Compatibility Shim&amp;rdquo;&lt;/a&gt;, which can be enabled make the process of migration from Web API 2 a bit easier. Let&amp;rsquo;s explore what&amp;rsquo;s in there.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>ASP.NET MVC 6 attribute routing – the [controller] and [action] tokens</title>
      <link>https://www.strathweb.com/2015/01/asp-net-mvc-6-attribute-routing-controller-action-tokens/</link>
      <pubDate>Wed, 07 Jan 2015 12:28:29 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2015/01/asp-net-mvc-6-attribute-routing-controller-action-tokens/</guid>
      <description>&lt;p&gt;When working with attribute routing in Web API 2 or MVC 5 it was relatively easy to get the route to the controller and the controller name out of sync. That was because the route always had to be specified as a string, so whenever you changed the name of the controller you would always have to change the string in the route attribute too.&lt;/p&gt;
&lt;p&gt;That could be easily forgotten - especially if you use refactoring tools of Visual Studio or an external refactoring plugin.&lt;/p&gt;
&lt;p&gt;This issue has been addressed in MVC6 with a tiny addition - the introduction of &lt;em&gt;[controller]&lt;/em&gt; ad &lt;em&gt;[action]&lt;/em&gt; tokens into attribute routing.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Formatters in ASP.NET MVC 6</title>
      <link>https://www.strathweb.com/2014/11/formatters-asp-net-mvc-6/</link>
      <pubDate>Mon, 17 Nov 2014 12:01:30 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2014/11/formatters-asp-net-mvc-6/</guid>
      <description>&lt;p&gt;One of the key concepts in HTTP API development is the notion of content negotiation (conneg). ASP.NET Web API provided first class support for content negotiation through the use of &lt;em&gt;MediaTypeFormatters&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;While MVC 6 is a de facto brand new framework, rebuilt from scratch, the majority of concepts from MVC 5 and Web API 2 have naturally been brought forward, and conneg done through formatters are one of them.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s have a look at formatters in MVC6.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>POCO controllers in ASP.NET vNext</title>
      <link>https://www.strathweb.com/2014/06/poco-controllers-asp-net-vnext/</link>
      <pubDate>Wed, 11 Jun 2014 09:34:38 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2014/06/poco-controllers-asp-net-vnext/</guid>
      <description>&lt;p&gt;One of the very cool features of the vNext of ASP.NET MVC (a unified framework set to succeed MVC, Web API and Web Pages) is the ability use POCO classes as controllers. No base class, no interface to implement, 100% convention.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s look a little bit into that.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Adding Session support to ASP.NET Web API</title>
      <link>https://www.strathweb.com/2012/11/adding-session-support-to-asp-net-web-api/</link>
      <pubDate>Fri, 09 Nov 2012 04:11:36 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/11/adding-session-support-to-asp-net-web-api/</guid>
      <description>&lt;p&gt;First the disclaimer. Yes, there are &lt;a href=&#34;http://brockallen.com/2012/04/07/think-twice-about-using-session-state/&#34;&gt;a lot of problems&lt;/a&gt; with using session in your ASP.NET applications. Moreover, by default, HTTP (and by extension, REST) is stateless - and as a result &lt;em&gt;each HTTP request should carry enough information by itself for its recipient to process it to be in complete harmony with the stateless nature of HTTP&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;So if you are designing a proper API, if you are a REST purist, or if you are &lt;a href=&#34;https://twitter.com/darrel_miller&#34;&gt;Darrel Miller&lt;/a&gt;, you definitely do not want to continue reading this article. But if not, and you find yourself in a scenario requiring session - perhaps you are using Web API to facilitate your JS or MVC application, and you want to sync the state of Web API with the state of MVC easily, or you simply want a quick and easy way to persist state on the server side - this article is for you.&lt;/p&gt;
&lt;p&gt;More after the jump.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Supporting OData $inlinecount with the new Web API OData preview package</title>
      <link>https://www.strathweb.com/2012/08/supporting-odata-inlinecount-with-the-new-web-api-odata-preview-package/</link>
      <pubDate>Thu, 23 Aug 2012 11:43:02 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/08/supporting-odata-inlinecount-with-the-new-web-api-odata-preview-package/</guid>
      <description>&lt;p&gt;OData support in Web API is arguably one of its hottest features. However, it&amp;rsquo;s support in Web API has been a bumpy ride - initially, OData was supported in a limited way only, and ultimately ended up being yanked altogether from the Web API RTM. It is however stil lpossible to use OData with Web API, only in a slighly different form , as an [external NuGet package][1], which, in its pre-release alpha format was published last Wednesday, along the Web API RTM release.&lt;/p&gt;
&lt;p&gt;This package is called &lt;strong&gt;Microsoft ASP.NET Web API OData&lt;/strong&gt; and is a joint effort by Microsoft&amp;rsquo;s Web API and OData teams. Alex James has written a [great introduction][2] to the package, so I recommend reading it.&lt;/p&gt;
&lt;p&gt;In the meantime, let me show you how to add $inlinecount support as for the time being, it&amp;rsquo;s still not provided there out of the box.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>ASP.NET Web API is released! What’s new in Web API RTM and how to use it!</title>
      <link>https://www.strathweb.com/2012/08/asp-net-web-api-is-released-whats-new-in-web-api-rtm-and-how-to-use-it/</link>
      <pubDate>Wed, 15 Aug 2012 17:32:46 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/08/asp-net-web-api-is-released-whats-new-in-web-api-rtm-and-how-to-use-it/</guid>
      <description>&lt;p&gt;If you have been following this blog for a while now (and if not, I really hope you will!), you&amp;rsquo;d know that I am a big fan of Web API. I have been blogging a lot about Web API, through its beta, RC stages and even about features that were only available through the Codeplex builds and I have to say that it is a terrific bridge between CLR and HTTP and fits really nicely into the existing landspace of web technologies.&lt;/p&gt;
&lt;p&gt;With that said, today is a really big and important day, as Web API has been publicly released in its RTM version. This effectively means that you have binaries you can safely use in production scenarios and take advantage of all the great features of the framework. You can [download MVC4 (including Web API) RTM here][1].&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s go through the new features in RTM.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Testing routes in ASP.NET Web API</title>
      <link>https://www.strathweb.com/2012/08/testing-routes-in-asp-net-web-api/</link>
      <pubDate>Sun, 12 Aug 2012 09:10:30 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/08/testing-routes-in-asp-net-web-api/</guid>
      <description>&lt;p&gt;The question that often comes up when talking to developers and clients about Web API solutions is how exactly should you go about testing your route configuration in Web API? Some would perhaps argue that in certain cases, especially if you stick to RESTful approach, this type of testing wouldn&amp;rsquo;t even be necessary, because the convention over configuration provided by the framework means that you effecitvely end up testing something that&amp;rsquo;s internal working of Web API.&lt;/p&gt;
&lt;p&gt;With that said, especially when you have complex routes, or when you break the Restful approach and provide RPC-style API, or if you have your API actions decorated with HTTP verbs that don&amp;rsquo;t match the action names, you probably want to (and probably should, if you ask me) test the API routing to make sure certain requests end up in proper places.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s deal with this interesting problem.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Adding OpenID authentication to your ASP.NET MVC 4 application</title>
      <link>https://www.strathweb.com/2012/08/adding-openid-authentication-to-your-asp-net-mvc-4-application/</link>
      <pubDate>Wed, 01 Aug 2012 20:18:05 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/08/adding-openid-authentication-to-your-asp-net-mvc-4-application/</guid>
      <description>&lt;p&gt;I am currently working on an MVC4 project that allows users to authenticate through OpenID. I don&amp;rsquo;t think I need to convince anyone about the benefits for both parties that come with that. Users don&amp;rsquo;t have to register at your site, and you have less of those tedious account maintance tasks.&lt;/p&gt;
&lt;p&gt;Although it&amp;rsquo;s apparently coming later on as a built-in feature into the Visual Studio templates (Damien Edwards showed that stuff for Web Forms during aspConf), let me show how you can very quickly add simple OpenID support to your MVC4 application.&lt;/p&gt;
&lt;p&gt;More after the jump.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Everything you want to know about ASP.NET Web API content negotiation</title>
      <link>https://www.strathweb.com/2012/07/everything-you-want-to-know-about-asp-net-web-api-content-negotation/</link>
      <pubDate>Sun, 15 Jul 2012 16:04:21 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/07/everything-you-want-to-know-about-asp-net-web-api-content-negotation/</guid>
      <description>&lt;p&gt;One of the key concepts in ASP.NET Web API, lying pretty much at the heart of it, is content negotiation - or simply &lt;em&gt;conneg&lt;/em&gt;. I really believe that, before you start developing Web API solutions, you need to understand conneg well.&lt;/p&gt;
&lt;p&gt;I thought it would be interesting to try to explain content negotiation in detail - what it is, what it does, and why it does that, especially as I have seen a lot of questions, misconceptions and misunderstandings around it on various boards or question sites.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Using NLog to provide custom tracing for your ASP.NET Web API</title>
      <link>https://www.strathweb.com/2012/06/using-nlog-to-provide-custom-tracing-for-your-asp-net-web-api/</link>
      <pubDate>Mon, 25 Jun 2012 17:41:01 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/06/using-nlog-to-provide-custom-tracing-for-your-asp-net-web-api/</guid>
      <description>&lt;p&gt;One of the things I love most about MVC3, and now ASP.NET Web API, is that pretty much any functionality or service that is used by your application, can be replaced with a custom one. One of these is the entire tracing mechanism that Web API uses.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s have a look today at how you can build a simple &lt;em&gt;System.Web.Http.Tracing.ITraceWriter&lt;/em&gt; implementation to provide support for a custom logging framework in your Web API - in our case it will be NLog.&lt;/p&gt;
&lt;p&gt;More after the jump.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>ASP.NET Web API integration testing with in-memory hosting</title>
      <link>https://www.strathweb.com/2012/06/asp-net-web-api-integration-testing-with-in-memory-hosting/</link>
      <pubDate>Tue, 12 Jun 2012 16:47:30 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/06/asp-net-web-api-integration-testing-with-in-memory-hosting/</guid>
      <description>&lt;p&gt;In-memory hosting is one of the hidden gems of ASP.NET Web API. While the community, forums, bloggers have been buzzing about web-host and self-host capabilities of Web API, aside from the &lt;a href=&#34;http://pfelix.wordpress.com/2012/03/05/asp-net-web-api-in-memory-hosting/&#34; target=&#34;_blank&#34;&gt;terrific post&lt;/a&gt; by Pedro Felix, very little has been said about &lt;strong&gt;in memory hosting&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Let me show you an example today, how a lightweight Web API server can be temporarily established in memory (without elevated priviliges, or cannibalizing ports like self host) and used to perform integration testing, allowing you to test almost the entire pipeline, from the request to the response.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Control the execution order of your filters in ASP.NET Web API</title>
      <link>https://www.strathweb.com/2012/06/control-the-execution-order-of-your-filters-in-asp-net-web-api/</link>
      <pubDate>Fri, 08 Jun 2012 16:00:31 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/06/control-the-execution-order-of-your-filters-in-asp-net-web-api/</guid>
      <description>&lt;p&gt;One of the few minor annoyances in ASP.NET Web API is that you lack the ability to control the order in which the attributes/filters are executed. If you have several of those applied to one action, they will not run in the order they have been declared in the code, and that sometimes may cause a lot of problems.&lt;/p&gt;
&lt;p&gt;In fact, as a member of the ASP.NET Web API Advisory Group I already brought that up during our meetings, not to mention it has already been submitted as an issue to the ASP.NET team on Codeplex. In the meantime, let&amp;rsquo;s tackle this problem and see how you can easily regain control over the execution order of the attributes.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Extending your ASP.NET Web API responses with useful metadata</title>
      <link>https://www.strathweb.com/2012/06/extending-your-asp-net-web-api-responses-with-useful-metadata/</link>
      <pubDate>Sun, 03 Jun 2012 13:27:13 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/06/extending-your-asp-net-web-api-responses-with-useful-metadata/</guid>
      <description>&lt;p&gt;If you ever worked with any API, which, in this day of age, you must have, you surely noticed that in most situations the API response isn&amp;rsquo;t just the result (requested data), but also a set of helpful metadata, like &amp;ldquo;total Results&amp;rdquo;, &amp;ldquo;timestamp&amp;rdquo;, &amp;ldquo;status&amp;rdquo; and so on.&lt;/p&gt;
&lt;p&gt;In Web API, by default, you just serialize your models (or DTO) and such information are not present. Let&amp;rsquo;s build something which will solve this problem and help you decorate your response with hepful information. This would make it very easy for the client to implement paging, auto-loading scenarios, caching (if you return last modified information) and a lot more.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Using Ninject with the latest ASP.NET Web API source</title>
      <link>https://www.strathweb.com/2012/05/using-ninject-with-the-latest-asp-net-web-api-source/</link>
      <pubDate>Sun, 27 May 2012 09:24:51 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/05/using-ninject-with-the-latest-asp-net-web-api-source/</guid>
      <description>&lt;p&gt;After ASP.NET Web API was beta-released in February, a number of blog posts came out explaining how to plug Ninject (and other IoC-s, for that matter) to your application through the use of the IDependencyResolver adapter. There was even a NuGet Ninject extension for that (&lt;a href=&#34;http://nuget.org/packages/Ninject.Web.WebApi&#34;&gt;here&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;However, these approaches don&amp;rsquo;t work anymore if you are using the latest ASP.NET Web API (and release candidate) - either from Codeplex source or nightly build packages.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s explore why is that and what you need to do now to be able to use Ninject with ASP.NET Web API.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Attribute based routing in ASP.NET Web API</title>
      <link>https://www.strathweb.com/2012/05/attribute-based-routing-in-asp-net-web-api/</link>
      <pubDate>Wed, 23 May 2012 20:05:34 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/05/attribute-based-routing-in-asp-net-web-api/</guid>
      <description>&lt;p&gt;Routing is the key aspect of every MVC application - after all, it&amp;rsquo;s how people get to your application, and how search engines see it. As flexible as routing in ASP.NET MVC has been, one would often end up in frustrating situations where more flexibility was needed (or you simply started getting lost in a maze of routes). One of the finest extensions to ASP.NET MVC I have ever worked with is the excellent library &lt;em&gt;AttributeRouting&lt;/em&gt; by &lt;a href=&#34;https://github.com/mccalltd/AttributeRouting&#34;&gt;Tim McCall&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Last month, through the great work of &lt;a href=&#34;http://kamranicus.com/&#34;&gt;Kamran Ayub&lt;/a&gt;, the library has been extended to support ASP.NET Web API, and is now available on NuGet. Let&amp;rsquo;s have a look at how it can immediately make your life easier and drastically improve the way you handle your routes.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Implementing message handlers to track your ASP.NET Web API usage</title>
      <link>https://www.strathweb.com/2012/05/implementing-message-handlers-to-track-your-asp-net-web-api-usage/</link>
      <pubDate>Wed, 16 May 2012 20:49:01 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/05/implementing-message-handlers-to-track-your-asp-net-web-api-usage/</guid>
      <description>&lt;p&gt;Today&amp;rsquo;s focus is going to be on message handlers (or, to be precise, DelegatingHandlers) in ASP.NET Web API. If you are familiar with WCF you can surely recall them - used to be called DelegatingChannels at some point - but the purpose has been the same all along, to provide the first (or last, depending whether you look at requests or responses) extendibility point in your Web API applications. You stack up as many message handlers on top of each other as you wish, and the request will travel through all of them.&lt;/p&gt;
&lt;p&gt;This, in turn, gives us developers a possibility to process/alter/modify/decline the incoming HTTP request before it reaches the &lt;em&gt;HttpControllerDispatcher&lt;/em&gt;. Then, when the controller creates the response, it goes through the same chain of message handlers again, so we can tamper with the response. One example of the applicability of this is that message handlers are a perfect place to address security related matters i.e. integrating OAuth.&lt;/p&gt;
&lt;p&gt;The plan for today is to show how DelegatingHandlers are used by building a functionality that checks for an API key on an incoming API request and then logs all requests and responses, thus allowing you to track the usage of your API.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Output caching in ASP.NET Web API</title>
      <link>https://www.strathweb.com/2012/05/output-caching-in-asp-net-web-api/</link>
      <pubDate>Thu, 10 May 2012 16:46:17 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/05/output-caching-in-asp-net-web-api/</guid>
      <description>&lt;p&gt;Today we will continue with our favorite topic - ASP.NET Web API. I&amp;rsquo;ve heard folks asking about how you could easily cache the output of the API methods. Well, in ASP.NET MVC, that&amp;rsquo;s dead easy, just decorate the Action with [OutputCache] attribute and that&amp;rsquo;s it. Unfortunately, ASP.NET Web API doesn&amp;rsquo;t have a built-in support for this attribute.&lt;/p&gt;
&lt;p&gt;Which doesn&amp;rsquo;t mean you can&amp;rsquo;t have it. Let&amp;rsquo;s build one&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Native HTML5 push notifications with ASP.NET Web API and Knockout.js</title>
      <link>https://www.strathweb.com/2012/05/native-html5-push-notifications-with-asp-net-web-api-and-knockout-js/</link>
      <pubDate>Sun, 06 May 2012 14:19:08 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/05/native-html5-push-notifications-with-asp-net-web-api-and-knockout-js/</guid>
      <description>&lt;p&gt;The ASP.NET Web API project progresses at a rapid pace, and has already come a long way since the beta release. And as it is OSS now, it&amp;rsquo;s really great that we all can see the progress being made (thanks, MS!). So today we are going to build a native HTML5 push notifications mechanism over HTTP protocol, utilizing the latest exciting features of Web API (PushStreamContent), modern browsers&amp;rsquo; &lt;a href=&#34;http://en.wikipedia.org/wiki/Server-sent_events&#34;&gt;Server-sent Events EventSource API&lt;/a&gt; and, of course, Knockout.js.&lt;/p&gt;
&lt;p&gt;Few weeks ago Henrik Nielsen on his blog was kind enough to &lt;a href=&#34;http://blogs.msdn.com/b/henrikn/archive/2012/04/23/using-cookies-with-asp-net-web-api.aspx&#34;&gt;share some updates&lt;/a&gt; about the latest feauters available in the ASP.NET Web API. We are going to be using his sample code as the starting point to develop an application utilizing a real HTTP push messaging infrastructure. We&amp;rsquo;ll use that to build a browser-based multi-person chat, but the principles showed here could be used for pretty much anything that requires pushing content to the client.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Different MediaTypeFormatters for same MediaHeaderValue in ASP.NET Web API</title>
      <link>https://www.strathweb.com/2012/04/different-mediatypeformatters-for-same-mediaheadervalue-in-asp-net-web-api/</link>
      <pubDate>Fri, 27 Apr 2012 15:39:39 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/04/different-mediatypeformatters-for-same-mediaheadervalue-in-asp-net-web-api/</guid>
      <description>&lt;p&gt;Let’s say you have a model and want to serve it through a different MediaTypeFormatter from different controllers or routes or urls? You want same content type (MediaHeaderValue) request, to be formatted differently in different situations - how could you do that, if everything resides in GlobalConfiguration?&lt;/p&gt;
&lt;p&gt;It would be perfect to be able to use per-controller configuration in ASP.NET Web API. Unfortunately, at this stage, this feature is not yet supported. &lt;a href=&#34;http://www.twitter.com/frystyk&#34;&gt;Henrik&lt;/a&gt; mentioned that &lt;a href=&#34;http://blogs.msdn.com/b/jmstall/&#34;&gt;Mike Stall&lt;/a&gt; is currently working on this, and it will be supported in the full release on Web API (perhaps even earlier, on codeplex?).&lt;/p&gt;
&lt;p&gt;Anyway, let&amp;rsquo;s take this idea for a spin and explore what we could do in &lt;em&gt;beta&lt;/em&gt; version of ASP.NET Web API, because we could still vary our formatters and responses.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>RSS &amp; Atom MediaTypeFormatter for ASP.NET WebAPI</title>
      <link>https://www.strathweb.com/2012/04/rss-atom-mediatypeformatter-for-asp-net-webapi/</link>
      <pubDate>Sun, 22 Apr 2012 12:53:12 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/04/rss-atom-mediatypeformatter-for-asp-net-webapi/</guid>
      <description>&lt;p&gt;Today we are going to build a custom formatter for ASP.NET WebAPI, deriving from MediaTypeFormatter class. It will return our model (or collection of models) in RSS or Atom format.&lt;br&gt;
The Formatter is supposed to react to requests sent with request headers &amp;ldquo;Accept: application/atom+xml&amp;rdquo; and &amp;ldquo;Accept: application/rss+xml&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get going.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>HTML5 drag and drop asynchronous multi file upload with ASP.NET WebAPI</title>
      <link>https://www.strathweb.com/2012/04/html5-drag-and-drop-asynchronous-multi-file-upload-with-asp-net-webapi/</link>
      <pubDate>Wed, 04 Apr 2012 21:53:20 +0000</pubDate>
      
      <guid>https://www.strathweb.com/2012/04/html5-drag-and-drop-asynchronous-multi-file-upload-with-asp-net-webapi/</guid>
      <description>&lt;p&gt;Today we are going to build a neat HTML5 file uploader using ASP.NET Web API and jQuery. We are also going to include knockout.js to keep the list of uploaded files updating smoothly in real time.&lt;/p&gt;
&lt;p&gt;In addition to all that, we will leverage on HTML5 drag and drop events , as well as HTML5 File API, to provide the file input to the application. Finally, we will use &lt;a href=&#34;https://developer.mozilla.org/en/XMLHttpRequest/FormData&#34; target=&#34;_blank&#34;&gt;FormData JS interface&lt;/a&gt; to build up the request, and we will use ApiController of our ASP.NET MVC 4 application to pick up the files and save them on the server using an instance of MultipartFormDataStreamProvider.&lt;/p&gt;
&lt;p&gt;More after the jump.&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
