Decrypting DPAPI (aspnet_setreg) stored credentials

I came across a problem at work where I needed to recover credentials that had been stored in the registry using .Net’s DPAPI (aspnet_setreg). Thankfully the open source NCrypto library came to the rescue.
Here’s a simple bit of code making use of the NCrypto.Security.Cryptography assembly to decrypt the data:
<%@ Page Language=”C#” Debug=”true” %>
<script language=”C#” runat=”Server”>
protected [...]